Cod sursa(job #341412)
| Utilizator | Data | 18 august 2009 14:26:39 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <stdio.h>
#include <map>
using namespace std;
map<int,int> h;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n,op,key,i;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d%d",&op,&key);
switch (op)
{
case 1:
if (h.find(key) == h.end())
{
h[key] = 1;
}
break;
case 2:
h.erase(key);
break;
case 3:
if (h.find(key) != h.end())
{
printf("1\n");
}
else
{
printf("0\n");
}
break;
}
}
return 0;
}