Pagini recente » Cod sursa (job #725150) | Cod sursa (job #1805478) | Cod sursa (job #11387) | Cod sursa (job #1424786) | Cod sursa (job #1048181)
#include <fstream>
//#include<cstdio>
#include<vector>
#define H 1003
using namespace std;
ifstream fin("hashuri.in");//freopen("hashuri.in","r",stdin);
ofstream fout("hashuri.out");//freopen("hashuri.out","w",stdout);
vector<int> h[H];
int n,x,y,k;
int main()
{
//scanf("%d",&n);
fin>>n;
for(;n;n--)
{
//scanf("%d%d",&x,&y);
fin>>x>>y;
k=y%H;
vector<int>::iterator it;
for(it=h[k].begin();it!=h[k].end();it++)
if(*it==y)
break;
if(x==1)
{
if(it==h[k].end())
h[k].push_back(y);
}
else
if(x==2)
{
if(it!=h[k].end())
{
*it=h[k].back();
h[k].pop_back();
}
}
else
if(it==h[k].end())//?printf("0\n"):printf("1\n");
fout<<"0\n";
else
fout<<"1\n";
}
return 0;
}