Pagini recente » Cod sursa (job #1694783) | Cod sursa (job #559068) | Cod sursa (job #2649489) | Cod sursa (job #2694300) | Cod sursa (job #2570459)
#include <bits/stdc++.h>
#define mod 1000017
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int x,n,cod,inhash;
vector<int> h[mod+3];
vector<int>::iterator it;
int main() {
fin>>n;
while (n--) {
fin>>cod>>x;
if (cod==1) {
inhash=0;
if (find(h[x%mod].begin(),h[x%mod].end(),x)!=h[x%mod].end())
inhash=1;
if (inhash==0)
h[x%mod].push_back(x);
}
else if (cod==2) {
for (it=h[x%mod].begin();it!=h[x%mod].end();it++)
if (*it==x) {
h[x%mod].erase(it);
break;
}
}
else {
if (find(h[x%mod].begin(),h[x%mod].end(),x)!=h[x%mod].end())
fout<<"1\n";
else
fout<<"0\n";
}
}
return 0;
}