Pagini recente » Cod sursa (job #1071497) | Cod sursa (job #505745) | Cod sursa (job #2347730) | Cod sursa (job #2347733) | Cod sursa (job #2527640)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int H = 1000003;
vector<int> v[H];
int n,o,x,h;
int main()
{
f>>n;
auto it=v[0].begin();
for(;n;n--)
{
f>>o>>x;
h=x%H;
for(it=v[h].begin();it!=v[h].end();it++)
if(*it==x)
break;
if(o==1)
{
if(it==v[h].end())
v[h].push_back(x);
}
else
if(o==2)
{
if(it!=v[h].end())
{
*it=v[h].back();
v[h].pop_back();
}
}
else
if(it==v[h].end())
g<<"0\n";
else
g<<"1\n";
}
return 0;
}