Pagini recente » Cod sursa (job #2365838) | Cod sursa (job #2422607) | Cod sursa (job #3220669) | Cod sursa (job #1624251) | Cod sursa (job #965816)
Cod sursa(job #965816)
#include <cstdio>
#include <vector>
#define MOD 666013
using namespace std;
int N, x, y;
vector<int> G[MOD];
inline vector<int>::iterator find_value(int x) {
int list = x % MOD;
for (vector<int>::iterator it = G[list].begin(); it != G[list].end(); ++it) {
if (*it == x) {
return it;
}
}
return G[list].end();
}
inline void inst_value(int x) {
int list = x % MOD;
if (find_value(x) == G[list].end()) {
G[list].push_back(x);
}
}
inline void eras_value(int x) {
int list = x % MOD;
vector<int>::iterator it = find_value(x);
if (it != G[list].end()) {
G[list].erase(it);
}
}
int main() {
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
for ( scanf("%d", &N); N; --N ) {
scanf("%d %d", &x, &y);
if (x == 1) {
inst_value(y);
continue;
}
if (x == 2) {
eras_value(y);
continue;
}
printf("%d\n", find_value(y) != G[y % MOD].end());
}
return 0;
}