Pagini recente » Cod sursa (job #2905147) | Cod sursa (job #2332434) | Cod sursa (job #918122) | Cod sursa (job #37762) | Cod sursa (job #2210861)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int CONST = 666013;
int N, cer, x;
vector<int> a[CONST + 1];
inline void find_and_delete(int x) {
for(auto it = a[x % CONST].begin(); it != a[x % CONST].end(); it++) {
if(*it == x) {
a[x % CONST].erase(it);
break;
}
}
}
inline bool is_in(int x) {
for(auto it = a[x % CONST].begin(); it != a[x % CONST].end(); it++) {
if(*it == x) return true;
}
return false;
}
int main() {
f >> N;
for(int i = 1; i <= N; i++) {
f >> cer >> x;
if(cer == 1 && !is_in(x))
a[x % CONST].push_back(x);
else if(cer == 2)
find_and_delete(x);
else if(cer == 3)
g << is_in(x) << "\n";
}
return 0;
}