Pagini recente » Cod sursa (job #360566) | Cod sursa (job #2160448) | Cod sursa (job #283768) | Cod sursa (job #636253) | Cod sursa (job #1290185)
#include <cstdio>
#include <vector>
using namespace std;
#define BSIZE 262143
#define MOD 66613
char buffer[BSIZE];
int p,type,X,N;
bool is;
vector < int > H[MOD];
vector < int > :: iterator P,it;
int readInt()
{
int number=0,sgn=1;
while (!('0'<=buffer[p] && buffer[p]<='9'))
{
if (buffer[p]=='-') sgn=-1;
if (p==BSIZE-1)
{
fread(buffer,1,BSIZE,stdin);
p=0;
} else ++p;
}
while ('0'<=buffer[p] && buffer[p]<='9')
{
number=number*10+buffer[p]-'0';
if (p==BSIZE-1)
{
fread(buffer,1,BSIZE,stdin);
p=0;
} else ++p;
}
return sgn*number;
}
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
N=readInt();
while (N--)
{
type=readInt();
X=readInt();
is=false;
for (it=H[X%MOD].begin();it!=H[X%MOD].end();++it)
if (*it==X) is=true,P=it;
if (type==1)
{
if (is) continue;
H[X%MOD].push_back(X);
continue;
}
if (type==2)
{
if (!is) continue;
H[X%MOD].erase(P);
continue;
}
if (is) printf("1\n");
else printf("0\n");
}
return 0;
}