Cod sursa(job #307703)

Utilizator AndreiDDiaconeasa Andrei AndreiD Data 24 aprilie 2009 19:37:39
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.75 kb
#include <cstdio>   
#include <set>   

 
using namespace std;   
  
#define file_in "hashuri.in"   
#define file_out "hashuri.out"   
   
  
set<int> v;   
  
int main()   
{   
    int i,n,tip,x;
    freopen(file_in,"r",stdin);   
    freopen(file_out,"w",stdout);   
       
    scanf("%d", &n);   
    for (i=1;i<=n;++i)   
    {   
        scanf("%d %d", &tip,&x);   
        if (tip==1)   
            v.insert(x);   
        else  
        if (tip==2)   
            v.erase(x);   
        else  
        {   
        if (v.find(x)==v.end())   
             printf("0\n");   
        else  
             printf("1\n");   
        }   
    }   
  
    fclose(stdin);   
    fclose(stdout);   
       
    return 0;   
}