Pagini recente » Cod sursa (job #2362511) | Cod sursa (job #257500) | Cod sursa (job #3225760) | Cod sursa (job #572039) | Cod sursa (job #2107872)
#include<fstream>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
#define MOD 72953
struct nod
{
long long info;
nod *urm;
};
nod *a[MOD+1];
int cauta(int x)
{
nod *p=a[x%MOD];
while(p)
{
if(p->info==x/MOD)return 1;
p=p->urm;
}
return 0;
}
void sterge(int x)
{
nod *p=a[x%MOD];
while(p)
{
if(p->info==x/MOD){p->info=-1;
break;}
p=p->urm;
}
}
int main()
{
int n,v,x,sem,j;
f>>n;
for(int i=1;i<=n;i++)
{
f>>v>>x;
if(v==1){
if(!cauta(x)){
nod *p=new nod;
p->urm=a[x%MOD];
p->info=x/MOD;
a[x%MOD]=p;
}
}
else if(v==2){
if(cauta(x))
sterge(x);
}
else g<<cauta(x)<<'\n';
}
return 0;
}