Cod sursa(job #1042837)

Utilizator andreiiiiPopa Andrei andreiiii Data 27 noiembrie 2013 18:51:52
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.58 kb
#include <fstream>
#include <unordered_set>

using namespace std;

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

int main()
{
    unordered_set <int> a;
    unordered_set <int>::iterator it;
    int t, x, y;
    fin>>t;
    while(t--)
    {
        fin>>y>>x;
        if(y==1)
        {
            a.insert(x);
        }
        else if(y==2)
        {
            it=a.find(x);
            if(it!=a.end()) a.erase(it);
        }
        else
        {
            if(a.find(x)!=a.end()) fout<<"1\n";
            else fout<<"0\n";
        }
    }
}