Pagini recente » Cod sursa (job #1617164) | Cod sursa (job #2176380) | Cod sursa (job #1724406) | Cod sursa (job #1860514) | Cod sursa (job #2885654)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,op,x,baza,heshu[666013][100];
int main()
{ f>>n;
baza=666013;
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;
}