Pagini recente » Cod sursa (job #898215) | Cod sursa (job #2753227) | Cod sursa (job #2205375) | Cod sursa (job #2905376) | Cod sursa (job #2835722)
#include <fstream>
#include <list>
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
const int MOD = 666013;
list <int> v[MOD];
list <int> :: iterator it;
int main()
{
int n;
cin >> n;
while (n--)
{
int op, x;
cin >> op >> x;
int r = x % MOD;
bool ok = 0;
for (it = v[r].begin(); it != v[r].end(); it++)
if (*it == x)
{
ok = 1;
break;
}
if (op == 1)
{
if (!ok)
v[r].push_back(x);
}
else if (op == 2)
{
if (ok)
v[r].erase(it);
}
else
cout << ok << "\n";
}
}