Pagini recente » Cod sursa (job #1108098) | Cod sursa (job #2353591) | Cod sursa (job #2704421) | Cod sursa (job #1396206) | Cod sursa (job #1329799)
#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--;
break;
}
}
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;
}