Pagini recente » Cod sursa (job #2810841) | Cod sursa (job #207442) | Cod sursa (job #944670) | Cod sursa (job #460634) | Cod sursa (job #2040926)
/*#include<cstdio>
#include<set>
using namespace std;
set<int>s;
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n,i,c,x;
scanf("%d",&n);
for(i=1;i<=n;++i)
{
scanf("%d%d",&c,&x);
if(c==1)
s.insert(x);
else
{
if(c==2)
{
if(s.find(x)!=s.end())
s.erase(s.find(x));
}
else
{
if(s.find(x)!=s.end())
printf("1\n");
else
printf("0\n");
}
}
}
return 0;
}*/
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int p=666013;
vector<int>g[p+1];
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n,i,c,x;
scanf("%d",&n);
for(i=1;i<=n;++i)
{
scanf("%d%d",&c,&x);
if(c==1)
{
if(find(g[x%p].begin(),g[x%p].end(),x)==g[x%p].end())
g[x%p].push_back(x);
}
else
{
if(c==2)
{
if(find(g[x%p].begin(),g[x%p].end(),x)!=g[x%p].end())
g[x%p].erase(find(g[x%p].begin(),g[x%p].end(),x));
}
else
{
if(find(g[x%p].begin(),g[x%p].end(),x)!=g[x%p].end())
printf("1\n");
else
printf("0\n");
}
}
}
return 0;
}