Cod sursa(job #954576)
Utilizator | Andrei Stan StanAndrei | Data | 29 mai 2013 15:50:51 |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.58 kb |
#include <stdio.h>
#include <map>
using namespace std;
map<int, int> a;
int N,nr=0;
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
scanf("%d\n",&N);
int i,type,val;
for (i=1;i<=N;i++)
{
scanf("%d %d\n",&type,&val);
if (type==1) a[val]=++nr;
if (type==2) a.erase(val);
if (type==3)
if (a.find(val)!=a.end())
printf("1\n");
else
printf("0\n");
}
fclose(stdin);
fclose(stdout);
return 0;
}