Cod sursa(job #1018948)

Utilizator ZanarokStefan Mocanu Zanarok Data 30 octombrie 2013 10:34:30
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.87 kb
#include <iostream>
#include <cstdio>
#include <tr1/unordered_set>
using namespace std;
using namespace std::tr1;
int n;

int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    scanf("%d",&n);
    unordered_set<int> hesh;
    unordered_set<int>::iterator got;
    int a,b;
    for(int k=1;k<=n;k++)
    {
        scanf("%d %d",&a,&b);
        if(a==1)
        {
            got=hesh.find(b);
            if(got==hesh.end())
                hesh.insert(b);
        }
        else
            if(a==2)
                hesh.erase(b);
            else
                if(a==3)
                {
                    got=hesh.find(b);
                    if(got==hesh.end())
                        printf("0\n");
                    else
                        printf("1\n");
                }
    }
    return 0;
}