Cod sursa(job #717177)

Utilizator mytzuskyMihai Morcov mytzusky Data 19 martie 2012 18:40:03
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include <stdio.h>
#include <map>

#define m 666013
using namespace std;

int n,op,x;
map <int,char> hs;

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

    scanf("%d", &n);
    for(int i=1;i<=n;++i)
    {
        scanf("%d %d", &op, &x);
        x=x%m;
        if(op==1 && hs.find(x)==hs.end())
            hs[x] = 0;
        else if(op==2)
            hs.erase(x);
        else if(op==3)
            printf("%d\n", hs.find(x)!=hs.end());
    }
    return 0;
}