Pagini recente » Cod sursa (job #154633) | Cod sursa (job #2098974) | Cod sursa (job #1734027) | Cod sursa (job #1762834) | Cod sursa (job #2892289)
#include<fstream>
#include<vector>
#define M 524287
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> hashuri[M];
int n, x, y, k, ok;
int main(){
fin>>n;
for(int i=1; i<=n; i++){
fin>>x>>y;
k=y%M;
if(x==1){
ok=1;
for(int j=0; j<hashuri[k].size(); j++){
if(hashuri[k][j]==y){
ok=0;
break;
}
}
if(ok==1)
hashuri[k].push_back(y);
}
else{
if(x==2){
for(int j=0; j<hashuri[k].size(); j++){
if(hashuri[k][j]==y){
hashuri[k].erase(hashuri[k].begin()+j);
}
}
}
else{
if(x==3){
ok=0;
for(int j=0; j<hashuri[k].size(); j++){
if(hashuri[k][j]==y){
ok=1;
fout<<1<<"\n";
break;
}
}
if(ok==0){
fout<<0<<"\n";
}
}
}
}
}
}