Cod sursa(job #589063)
| Utilizator | Data | 10 mai 2011 18:56:12 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 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; 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 && 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;
}
