Pagini recente » Cod sursa (job #2949194) | Cod sursa (job #2062621) | Cod sursa (job #1562063) | Cod sursa (job #2577330) | Cod sursa (job #2524594)
#include <bits/stdc++.h>
#define mod 1000017
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,x,tip,poz,inhash;
vector<int> h[mod];
vector<int>::iterator it;
int main() {
fin>>n;
while (n--) {
fin>>tip>>x;
if (tip==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);
}
if (tip==2) {
for (it=h[x%mod].begin();it!=h[x%mod].end();it++)
if (*it==x) {
h[x%mod].erase(it);
break;
}
}
if (tip==3) {
inhash=0;
if (find(h[x%mod].begin(),h[x%mod].end(),x)!=h[x%mod].end())
inhash=1;
fout<<inhash<<"\n";
}
}
return 0;
}