Pagini recente » Cod sursa (job #2661079) | Cod sursa (job #2933459) | Cod sursa (job #2082938) | Cod sursa (job #2742561) | Cod sursa (job #653450)
Cod sursa(job #653450)
#include <iostream> //619999
#include <vector>
using namespace std;
vector <int> a[620000];
int main()
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
long long n,i,j,opt,x,nr=619999;
scanf("%lld", &n);
for (i=1;i<=n;i++){
scanf("%lld %lld", &opt, &x);
int cheie=x%nr;
for (j=0;j<a[cheie].size();j++){
if (a[cheie][j]==x)
break;
}
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;
}