Pagini recente » Cod sursa (job #1659895) | Cod sursa (job #2790330) | Cod sursa (job #1777300) | Cod sursa (job #1733162) | Cod sursa (job #1329796)
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector <int>v[666013];
vector<int>:: iterator it;
const int mod=666013;
void o1(int x)
{
v[x%mod].push_back(x);
}
void o2(int x)
{
int rest=x%mod;
for(it=v[rest].begin();it!=v[rest].end();it++)
if(*it==x)
{ *it=v[rest].back();
v[rest].pop_back();
it--;
}
}
int o3(int x)
{
int rest=x%mod;
for(it=v[rest].begin();it!=v[rest].end();it++)
if(*it==x) return 1;
return 0;
}
int main()
{
int n,op,x;
fin>>n;
while(n!=0)
{ fin>>op>>x;
if(op==1) o1(x);
else if(op==2) o2(x);
else fout<<o3(x)<<"\n";
n--;
}
return 0;
}