Pagini recente » Cod sursa (job #2799090) | Cod sursa (job #1601924) | Cod sursa (job #491324) | Cod sursa (job #102820) | Cod sursa (job #2038313)
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int M=666013;
vector<int> TA[M+5];
vector<int>:: iterator it;
int h(int key){
return key%M;
}
int main(){
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n;
scanf("%d", &n);
for(int i=1;i<=n;i++){
int tip,x;
scanf("%d%d", &tip, &x);
int a=h(x);
if(tip==1)
TA[a].push_back(x);
else
if(tip==2){
it=find(TA[a].begin(), TA[a].end(), x);
if(it!=TA[a].end())
TA[a].erase(it);
}
else{
it=find(TA[a].begin(), TA[a].end(), x);
if(it!=TA[a].end())
printf("1\n");
else
printf("0\n");
}
}
return 0;
}