Pagini recente » Cod sursa (job #1090212) | Cod sursa (job #535824) | Cod sursa (job #1684813) | Cod sursa (job #1867835) | Cod sursa (job #1054794)
#include<fstream>
#include<vector>
#define HASH 576123
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int>L[HASH];
vector<int>::iterator it;
int T, x, y, i, op, exista;
int main(){
fin>>T;
for(;T;T--){
fin>>op>>x;
y=x%HASH;
if(op==1){
exista=0;
for(it=L[y].begin();it!=L[y].end();it++){
if(*it==x){
exista=1;
}
}
if(!exista){
L[y].push_back(x);
}
}
if(op==2){
for(it=L[y].begin();it!=L[y].end();it++){
if (*it == x) {
L[y].erase(it);
break;
}
}
}
if(op==3){
exista=0;
for(it=L[y].begin();it!=L[y].end();it++){
if(*it==x){
exista=1;
break;
}
}
fout<<exista<<"\n";
}
}
return 0;
}