Cod sursa(job #1307010)

Utilizator obidanDan Ganea obidan Data 31 decembrie 2014 19:48:44
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.59 kb
#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <unordered_set>
using namespace std;
const int M = 666013;

unordered_set <int> H;


int main()
{
    freopen("hashuri.in","r",stdin);
    freopen("hashuri.out","w",stdout);
    int i,j,n,x,y;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d %d",&x,&y);
        if(x==1)
        {
            H.insert(y);
        }
        else if(x==2)
        {
            H.erase(y);
        }
        else
        {
            if(H.find(y) == H.end())
                printf("0\n");
            else printf("1\n");
        }
    }

}