Pagini recente » Cod sursa (job #2555445) | Cod sursa (job #2646567) | Cod sursa (job #86741) | Cod sursa (job #86728) | Cod sursa (job #2059242)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
const int MOD = 666013;
vector<int> G[MOD+5];
inline vector<int>::iterator find_value (int x){
int lista = x % MOD;
for (vector<int>::iterator it = G[lista].begin(); it != G[lista].end(); it++)
if (*it == x) return it;
return G[lista].end();
}
inline void insert_value (int x) {
int lista = x % MOD;
if(find_value(x) == G[lista].end())
G[lista].push_back(x);
}
inline void erase_value (int x) {
int lista = x % MOD;
vector<int>::iterator it = find_value(x);
if (it != G[lista].end())
G[lista].erase(it);
}
int main()
{
int n, op, x;
fin >> n;
while (n) {
fin >> op >> x;
n--;
if (op == 1){
insert_value(x);
continue;
}
if (op == 2){
erase_value(x);
continue;
}
fout << (find_value(x) != G[x % MOD].end()) << '\n';
}
return 0;
}