Cod sursa(job #730043)
| Utilizator | Data | 2 aprilie 2012 15:16:56 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#include <set>
using namespace std;
# define prim 19937
set <int> h[prim];
int main(){
int n,op,x;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
f>>n;
while (n){
n--;
f>>op>>x;
switch(op){
case 1:{
h[x%prim].insert(x);
break;
}
case 2:{
h[x%prim].erase(x);
break;
}
case 3:{
if(h[x%prim].find(x)==h[x%prim].end())
g<<0<<endl;
else
g<<1<<endl;
}
}
}
return 0;
}
