Pagini recente » Cod sursa (job #2277398) | Cod sursa (job #1536721) | Cod sursa (job #3239117) | Cod sursa (job #1884958) | Cod sursa (job #2474370)
#include <bits/stdc++.h>
#define MOD 100000007
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n;
vector <int> Hash[MOD];
void op1(int x){
int p = x % MOD;
for (int i = 0; i < Hash[p].size(); i++){
if (Hash[p][i] == x){
return;
}
}
Hash[p].push_back(x);
}
void op2 (int x){
int p = x % MOD;
for (int i = 0; i < Hash[p].size(); i++){
if (Hash[p][i] == x){
Hash[p].erase(Hash[p].begin() + i);
}
}
}
void op3 (int x){
int p = x % MOD;
for (int i = 0; i < Hash[p].size(); i++){
if (Hash[p][i] == x){
g << "1\n";
return;
}
}
g << "0\n";
return;
}
void dostuff(){
f >> n;
for (;n--;){
int op, val;
f >> op >> val;
if (op == 1){
op1(val);
} else {
if (op == 2){
op2(val);
} else {
op3(val);
}
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
dostuff();
return 0;
}