Pagini recente » Cod sursa (job #2759187) | Cod sursa (job #352312) | Cod sursa (job #568144) | Cod sursa (job #414186) | Cod sursa (job #2927421)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int P = 100003;
int n;
vector<int> H[P];
int main()
{
f>>n;
for(;n;n--)
{
int op,nr,h;
f>>op>>nr;
h=nr%P;
vector<int>::iterator it;
for(it=H[h].begin();it!=H[h].end();it++)
if(*it==nr)
break;
bool gasit = it!=H[h].end();
if(op==1)
{
if(!gasit)
H[h].push_back(nr);
}
else if(op==2)
{
if(gasit)
{
swap(*it,H[h].back());
H[h].pop_back();
}
}
else
g<<gasit<<'\n';
}
return 0;
}