Pagini recente » Cod sursa (job #241319) | Cod sursa (job #1002911) | Cod sursa (job #1070616) | Borderou de evaluare (job #502077) | Cod sursa (job #3358000)
#include <iostream>
#include <fstream>
#include <vector>
#include <list>
#include <utility>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int NMAX = 2000000000;
const int PRIM = 1000003;
list<int> h[PRIM];
int main()
{
int n;
fin >> n;
for(int i = 1; i <= n; i++)
{
int op, x;
fin >> op >> x;
int val = x % PRIM;
if(op == 1)
{
bool ok = 0;
for(const auto& elem : h[val])
if(elem == x)
{
ok = 1;
break;
}
if(!ok)
h[val].push_back(x);
}
else if(op == 2)
{
h[val].remove(x);
}
else
{
int rez = 0;
for(const auto& elem : h[val])
if(elem == x)
{
rez = 1;
break;
}
fout << rez << '\n';
}
}
return 0;
}