Cod sursa(job #1154336)
Utilizator | Data | 26 martie 2014 09:31:14 | |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
map<int, int> m;
int n, op, x;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
scanf("%d", &n);
for(int i=0; i<n; i++){
scanf("%d %d", &op, &x);
if(op == 1){
if(m.find(x)==m.end())
m[x] = 1;
}
else if(op == 2){
if(m.find(x)!=m.end())
m.erase(x);
}
else
printf("%d\n", m.find(x)!=m.end());
}
return 0;
}