Cod sursa(job #589066)
| Utilizator | Data | 10 mai 2011 19:00:17 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include<stdio.h>
#include<map>
using namespace std;
FILE*f=fopen("hashuri.in","r");
FILE*g=fopen("hashuri.out","w");
int i,m,op,x,nr; map<int,int> M;
int main () {
fscanf(f,"%d",&m);
for ( i = 1 ; i <= m ; ++i ){
fscanf(f,"%d %d",&op,&x);
if ( op == 1 ){
if ( M.find(x) == M.end() )
M[x] = i;
}
else if ( op == 2 ){
M.erase(x);
}
else{
fprintf(g,"%d\n",M.find(x) != M.end() );
}
}
fclose(f);
fclose(g);
return 0;
}
