Pagini recente » Cod sursa (job #1183822) | Cod sursa (job #3167863) | Cod sursa (job #282133) | Cod sursa (job #2941758) | Cod sursa (job #2193013)
#include <bits/stdc++.h>
#define rest 666013
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int>h[666015];
vector<int>::iterator low;
int n,c,x;
int main()
{
fin>>n;
for(int i=1;i<=n;i++)
{
fin>>c>>x;
if(c==1)
{
low=lower_bound(h[x%rest].begin(),h[x%rest].end(),x);
if(low!=h[x%rest].end() && h[x%rest][low-h[x%rest].begin()]==x)
continue;
h[x%rest].push_back(x);
continue;
}
if(c==2)
{
low=lower_bound(h[x%rest].begin(),h[x%rest].end(),x);
if(low==h[x%rest].end() || h[x%rest][low-h[x%rest].begin()]!=x)
continue;
h[x%rest].erase(low);
continue;
}
if(c==3)
{
bool k=0;
for(int j=0;j<h[x%rest].size();j++)
if(h[x%rest][j]==x)
{
k=1;
break;
}
fout<<k<<"\n";
}
}
return 0;
}