Cod sursa(job #432833)

Utilizator DraStiKDragos Oprica DraStiK Data 2 aprilie 2010 20:09:32
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <algorithm>
#include <ext/hash_set>
using namespace __gnu_cxx;
using namespace std;

hash_set <int> h;
int n;

int main ()
{
    freopen ("hashuri.in","r",stdin);
    freopen ("hashuri.out","w",stdout);
    int i,tip,x;

    scanf ("%d",&n);
    for (i=1; i<=n; ++i)
    {
        scanf ("%d%d",&tip,&x);
        if (tip==1)
            h.insert (x);
        else if (tip==2)
            h.erase (x);
        else
            printf ("%d\n",h.find (x)!=h.end ());
    }

    return 0;
}