Pagini recente » Cod sursa (job #3004477) | Cod sursa (job #1369213) | Cod sursa (job #2906141) | Cod sursa (job #744613) | Cod sursa (job #2552396)
#include <bits/stdc++.h>
using namespace std;
const int MOD = 66601;
list<int> H[MOD];
inline void add(int x){
int key = x % MOD;
H[key].push_back(key);
}
void del(int x){
int key = x % MOD;
for(auto it = H[key].begin(); it != H[key].end(); ++it){
if(*it == x){
H[key].erase(it);
break;
}
}
}
bool present(int x){
int key = x % MOD;
for(auto it = H[key].begin(); it != H[key].end(); ++it){
if(*it == x)
return 1;
}
return 0;
}
int main(){
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
int n, op, x;
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> op >> x;
if(op == 1)
add(x);
else if(op == 2)
del(x);
else
cout << present(x) << '\n';
}
cin.close(), cout.close();
}