Cod sursa(job #1376620)

Utilizator dianaa21Diana Pislaru dianaa21 Data 5 martie 2015 18:06:12
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include <fstream>
#include <map>
using namespace std;
ifstream is ("hashuri.in");
ofstream os ("hashuri.out");

map <int,int> M;
int N, type, x, cnt;

int main()
{
    is >> N;
    for(int i = 1; i <= N; ++i)
    {
        is >> type >> x;
        switch(type) {
            case 1:
                if(M.find(x) == M.end()) M[x] = 1;
                break;
            case 2:
                M.erase(x);
                break;
            case 3:
                if(M.find(x) == M.end()) os << "0\n";
                else os << "1\n";
        }
    }
    is.close();
    os.close();
    return 0;
}