Pagini recente » Cod sursa (job #510525) | Cod sursa (job #1376684) | Cod sursa (job #599068) | Monitorul de evaluare | Cod sursa (job #2895235)
#include <bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
#define cin f
#define cout g
const int Mod = 1000003;
list < int > Hash[Mod];
int main()
{
int n; cin >> n;
while(n --)
{
int op, x, poz;
cin >> op >> x;
poz = x % Mod;
if(op == 1)
{
bool ok = false;
for(auto it : Hash[poz])
if(it == x)
{
ok = true;
break;
}
if(ok == false)
Hash[poz].push_back(x);
}
else if(op == 2)
{
for(auto it = Hash[poz].begin(); it != Hash[poz].end(); it ++)
if(*it == x)
{
Hash[poz].erase(it);
break;
}
}
else
{
bool ok = false;
for(auto it : Hash[poz])
if(it == x)
{
ok = true;
break;
}
if(ok == true)
cout<<1<<'\n';
else
cout<<0<<'\n';
}
}
return 0;
}