Pagini recente » Cod sursa (job #625044) | Cod sursa (job #2095665) | Cod sursa (job #2238920) | Cod sursa (job #2694428) | Cod sursa (job #2885657)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,op,x,baza,heshu[9973][100];
int main()
{ f>>n;
baza=9973;
for(int i=1;i<=n;i++)
{ f>>op>>x;
int ok=0;
int poz=-1;
if(op==1)
{ for(int j=1;j<=heshu[x%baza][0];j++)
if(heshu[x%baza][j]==x)
ok=1;
if(ok!=1)
{ heshu[x%baza][0]++;
heshu[x%baza][heshu[x%baza][0]]=x;
}
}
if(op==2)
{ for(int j=1;j<=heshu[x%baza][0];j++)
if(heshu[x%baza][j]==x)
{ ok=1;
poz=j;
}
if(ok==1)
{ for(int j=poz;j<heshu[x%baza][0];j++)
heshu[x%baza][j]=heshu[x%baza][j+1];
heshu[x%baza][0]--;
}
}
if(op==3)
{ for(int j=1;j<=heshu[x%baza][0];j++)
if(heshu[x%baza][j]==x)
ok=1;
g<<ok<<'\n';
}
}
f.close();
g.close();
return 0;
}