Cod sursa(job #716952)
| Utilizator | Data | 19 martie 2012 14:03:08 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <stdio.h>
#include <map>
using namespace std;
int n,op,x;
map <int,int> 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);
if(op==1)
if(hs.find(x)==hs.end())
hs[x] = 1;
if(op==2)
hs.erase(x);
if(op==3)
if(hs.find(x) != hs.end())
printf("1\n");
else
printf("0\n");
}
return 0;
}
