Cod sursa(job #1952433)

Utilizator matystroiaStroia Matei matystroia Data 4 aprilie 2017 09:31:44
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <fstream>
#include <map>
using namespace std;

ifstream fin("hashuri.in");
ofstream fout("hashuri.out");

int n, op, x;
map<int, bool> m;

int main()
{
    fin>>n;
    for(int i=0;i<n;++i)
    {
        fin>>op>>x;

        if(op==1 && m.find(x)==m.end())
            m[x]=true;
        else if(op==2)
            m.erase(x);
        else if(op==3)
            fout<<(m.find(x)!=m.end())<<'\n';
    }
    return 0;
}