Pagini recente » Cod sursa (job #454232) | Cod sursa (job #3281443) | Cod sursa (job #2009333) | Cod sursa (job #304375) | Cod sursa (job #1690176)
#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[666615];
int m=666613;
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(!u)if(z->data==x&&z->p){cout<<"1\n";u=true;}
}
if(!u)cout<<"0\n";
}
}
return 0;
}