Pagini recente » Cod sursa (job #639640) | Cod sursa (job #2958835) | Cod sursa (job #2332175) | Cod sursa (job #169094) | Cod sursa (job #2624328)
#include <fstream>
#include <vector>
#include <utility>
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();
}