Pagini recente » Cod sursa (job #1906995) | Cod sursa (job #1295242) | Cod sursa (job #2251839) | Cod sursa (job #3143979) | Cod sursa (job #1690159)
#include<fstream>
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
typedef struct nod{
int data;
bool p;
nod* next;
}* hash;
void add(hash &p,int x){
hash z=new nod;
z->data=x;
z->p=1;
z->next=p;
p=z;
}
hash 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){
add(a[x%m],x);
}
if(y==2){
for(hash z=a[x%m];z!=NULL;z=z->next){
if(z->data=x)z->p=0;
}
}
if(y==3){bool u =false;
for(hash 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;
}