Pagini recente » Cod sursa (job #2011211) | Cod sursa (job #2476618) | Cod sursa (job #476912) | Cod sursa (job #4087) | Cod sursa (job #1690169)
#include<fstream>
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
typedef struct nod{
int data;
bool p;
nod* next;
}* h;
void add1(h &p,int x){
h z=new nod;
z->data=x;
z->p=1;
z->next=p;
p=z;
}
h a[100000];
int m=20000;
int n,x,y;
int main(){
cin>>n;
for(int i=0;i<n;i++){
cin>>y>>x;
if(y==1){
add1(a[x%m],x);
}
if(y==2){
for(h z=a[x%m];z!=NULL;z=z->next){
if(z->data=x)z->p=0;
}
}
if(y==3){bool u =false;
for(h z=a[x%m];z!=NULL;z=z->next){
if(z->data=x&&z->p){cout<<"1\n";u=true;}
}
if(!u)cout<<"0\n";
}
}
return 0;
}