Pagini recente » Cod sursa (job #2079163) | Rating Stelian Chichirim (stelian2000) | Cod sursa (job #481343) | Cod sursa (job #1214302) | Cod sursa (job #1587533)
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
long long E;
long N;
int op;
vector < int > v[393242];
typedef vector <int> v_it;
long h(long long x){
return x % 393241;
}
void INSERT(long x){
if (find(v[h(x)].begin(), v[h(x)].end(), x) == v[h(x)].end()){
v[h(x)].push_back(x);
}
}
void DELETE(long x){
v_it::iterator y = find(v[h(x)].begin(), v[h(x)].end(), x);
if (y != v[h(x)].end()){
v[h(x)].erase(y);
}
}
int main()
{
freopen("hashuri.in","r", stdin);
freopen("hashuri.out","w", stdout);
scanf("%ld",&N);
for(; N; --N){
scanf("%d%lld",&op, &E);
if (op == 1) INSERT(E);
if (op == 2) DELETE(E);
if (op == 3) {
printf("%d\n", find(v[h(E)].begin(), v[h(E)].end(), E) == v[h(E)].end() ? 0 : 1 );
}
}
return 0;
}