Pagini recente » Cod sursa (job #1192005) | Cod sursa (job #562262) | Cod sursa (job #829449) | Cod sursa (job #427485) | Cod sursa (job #2624327)
#include <fstream>
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
const int MOD = 666013;
vector<pair<int, bool> > H[MOD];
void add(int x){
int key = x % MOD;
for(auto &c: H[key])
if(c.first == x)
return;
H[key].push_back({x, 1});
}
void del(int x){
int key = x % MOD;
for(auto &c: H[key])
if(c.first == x)
c.second = 0;
}
bool present(int x){
int key = x % MOD;
for(auto &c: H[key])
if(c.first == x && c.second)
return 1;
return 0;
}
int main(){
int op, x, n;
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();
}