Pagini recente » Istoria paginii runda/proba_pregatire_ioit/clasament | Cod sursa (job #1640982) | Cod sursa (job #193852) | Diferente pentru utilizator/robybrasov intre reviziile 68 si 69 | Cod sursa (job #1795544)
#include <fstream>
#include <vector>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int p=100003;
int n,h,x;
vector<int> v[p];
int main()
{
f>>n;
for(;n;n--)
{
f>>o>>x;
h=x%p;
for(it=v[h].begin();it!=v[h].end();it++)
if(*it==v)
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;
}