Pagini recente » Cod sursa (job #1829574) | Cod sursa (job #1571778) | Cod sursa (job #3260502) | Cod sursa (job #2852520) | Cod sursa (job #1712702)
#include <fstream>
#include <vector>
#include <cmath>
#define ct 666013
using namespace std;
vector <int> h[ct+1];
vector <int> :: iterator it;
void op1 (int x)
{
int r=fmod(x,ct);
int j,s=0;
for (j=0; j<h[r].size(); j++)
{
if (h[r][j]==x)
{
s=1;
}
}
if (s==0)
{
h[r].push_back(x);
}
}
void op2 (int x)
{
int r=fmod(x,ct),j;
for (j=0; j<h[r].size(); j++)
{
if (h[r][j]==x)
{
h[r].erase(h[r].begin()+j);
}
}
/*for (it=h[r].begin(); it!=h[r].end(); it++)
{
if (*it==x)
{
h[r].erase(it);
}
}*/
}
void op3 (int x)
{
int r=fmod(x,ct);
int j,s=0;
for (j=0; j<h[r].size(); j++)
{
if (h[r][j]==x)
{
s=1;
}
}
if (s==1)
{
printf ("%d\n",1);
}
else
{
printf ("%d\n",0);
}
}
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
int N;
scanf ("%d",&N);
int i,tip,a;
for(i=1; i<=N; i++)
{
scanf ("%d%d",&tip,&a);
if (tip==1)
{
op1(a);
}
else if (tip==2)
{
op2(a);
}
else if (tip==3)
{
op3(a);
}
}
return 0;
}