Pagini recente » Cod sursa (job #1527265) | Cod sursa (job #1020230) | Cod sursa (job #2106186) | Cod sursa (job #2076553) | Cod sursa (job #2130924)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int N = 100003;
vector<int> v[N];
int x,cod,h,n;
int main()
{
f>>n;
auto it=v[0].begin();
for(;n;n--)
{
f>>cod>>x;
h=x%N;
for(it=v[h].begin();it!=v[h].end();it++)
if(*it==x)
break;
if(cod==1&&it==v[h].end())v[h].push_back(x);
if(cod==2&&it!=v[h].end()){*it=v[h].back();v[h].pop_back();}
if(cod==3)g<<(it!=v[h].end())<<'\n';
}
return 0;
}