Pagini recente » Cod sursa (job #1710943) | Cod sursa (job #2794733) | Cod sursa (job #2214728) | Statistici Misha S (Misha22) | Cod sursa (job #2911331)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,o,x;
const int H=100003;
vector<int> v[H];
int main()
{
fin>>n;
for(; n; n--)
{
fin>>o>>x;
int h=x/H;
int k=v[h].size(),i;
for(i=0; i<k; i++)
{
if(v[h][i]==x)
{
break;
}
}
if(o==1)
{
if(i==k)
{
v[h].push_back(x);
}
}
else if(o==2)
{
if(i<k)
{
swap(v[h][i],v[h][k-1]);
v[h].pop_back();
}
}
else if(i==k){
fout<<"0\n";
}
else
fout<<"1\n";
}
return 0;
}