Pagini recente » Cod sursa (job #275896) | Cod sursa (job #1011888) | Cod sursa (job #2627853) | Cod sursa (job #1696929) | Cod sursa (job #432001)
Cod sursa(job #432001)
//#include "stdafx.h"
#include<stdio.h>
#include<vector>
#define P 100007
using namespace std;
vector < int > hash[P];
int n,i,j,a,k,mod;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d%d",&a,&k);
mod=k%P;
if (a == 1)
hash[mod].push_back(k);
else
if (a == 2)
{
for (j=0;j<hash[mod].size();j++)
if (hash[mod][j]==k)
hash[mod][j]=0;
}
else
{
a=0;
for (j=0;j<hash[mod].size();j++)
if (hash[mod][j]==k)
{
a=1;
break;
}
printf("%d\n",a);
}
}
return 0;
}