Pagini recente » Cod sursa (job #2284675) | Cod sursa (job #837836) | Cod sursa (job #403398) | Cod sursa (job #1649163) | Cod sursa (job #653731)
Cod sursa(job #653731)
#include<stdio.h> //619999
#include<vector>
using namespace std;
vector <int> a[620000];
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
int n,i,j,opt,x,nr=619999,coord,ok,cheie;
scanf("%d", &n);
for (i=1;i<=n;i++)
{
scanf("%d",&opt);
scanf("%d",&x);
cheie=x%nr;
ok=0;
for (j=0;j<a[cheie].size();j++)
if (a[cheie][j]==x){
ok=1;
coord=j;
}
if (ok)
j=coord;
if (opt==1 && j==a[cheie].size())
a[cheie].push_back(x);
if (opt==2 && j!=a[cheie].size()){
a[cheie][j]=a[cheie][a[cheie].size()-1];
a[cheie].pop_back();
}
if (opt==3)
if (j==a[cheie].size())
printf("0");
else
printf("1");
}
return 0;
}