Cod sursa(job #986384)
| Utilizator | Data | 18 august 2013 16:50:30 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <stdio.h>
#include <map>
using namespace std;
int N,NR;
map<int, int> M;
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
int i,x,type;
scanf("%d\n",&N);
for (i=1;i<=N;i++)
{
scanf("%d %d\n",&type,&x);
if (type==1 && M.find(x)==M.end())
M[x]= ++NR;
if (type==2)
M.erase(x);
if (type==3)
if (M.find(x)!=M.end()) printf("1\n");
else printf("0\n");
}
fclose(stdin);
fclose(stdout);
return 0;
}
