Pagini recente » Cod sursa (job #84837) | Cod sursa (job #47764) | Cod sursa (job #780897) | Cod sursa (job #2018478) | Cod sursa (job #1509845)
#include <fstream>
#include <vector>
#define mod 666013
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,a;
vector<int>v[mod+5];
int cauta(int x)
{
int g,j;
g=0;
for(j=0;j<v[a].size();j++)
if(v[a][j]==x)
return j;
return 0;
}
void citire()
{
int i,j,x,op,poz;
bool g;
fin>>n;
a=x%mod;
for(i=1;i<=n;i++)
{
fin>>op>>x;
if(op==1)
if(!cauta(x))
v[a].push_back(x);
if(op==2)
{
poz=cauta(x);
if(poz)
v[a].erase(v[a].begin()+poz);
}
if(op==3)
if(cauta(x))
fout<<1<<'\n';
else
fout<<0<<'\n';
}
}
int main()
{
citire();
fout.close();
return 0;
}