Pagini recente » Profil tabara | Cod sursa (job #7445) | Istoria paginii warm-up-2004/solutii | Cod sursa (job #668850) | Cod sursa (job #445540)
Cod sursa(job #445540)
#include<cstdio>
#include<vector>
#define p 666013
using namespace std;
void read(), solve();
vector<int> v[p];
int n,c,x,h;
int main()
{
read();
solve();
return 0;
}
void read()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
}
void solve()
{
vector<int>::iterator it;
for(;n;n--)
{
scanf("%d%d",&c,&x);
h=x%p;
for(it=v[h].begin();it!=v[h].end();it++)
if(*it==x)
break;
if(c==1)
{
if(it==v[h].end())
v[h].push_back(x);
continue;
}
if(c==2)
{
if(it!=v[h].end())
{
*it=v[h].back();
v[h].pop_back();
}
continue;
}
it==v[h].end()?printf("0\n"):printf("1\n");
}
}