Cod sursa(job #730434)
Utilizator | Data | 6 aprilie 2012 12:28:57 | |
---|---|---|---|
Problema | Hashuri | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <set>
using namespace std;
# define prim 16843
set <int> h[prim];
int main(){
int n,op,x,i;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
f>>n;
for (i=0;i<n;i++){
f>>op>>x;
if (op==1)
h[x%prim].insert(x);
if (op==2)
h[x%prim].erase(x);
if (op==3)
if(h[x%prim].find(x)==h[x%prim].end())
g<<"0"<<endl;
else
g<<"1"<<endl;
}
return 0;
}