Pagini recente » Cod sursa (job #327622) | Borderou de evaluare (job #1569217) | Cod sursa (job #2200441) | Cod sursa (job #3229012)
#include <bits/stdc++.h>
using namespace std;
std::ifstream fin("hashuri.in");
std::ofstream fout("hashuri.out");
const int p = 1e6 + 7;
std::vector<int>v[p];
int q;
int main()
{
fin >> q;
for(int t = 0 ; t < q ; ++t)
{
int op , x , cx;
fin >> op >> x;
cx = x;
x = x % p;
if(op == 1)
{
v[x].push_back(cx);
}
else if(op == 2)
{
vector<int>aux;
for(const auto & el : v[x])
{
if(el != cx)
{
aux.push_back(el);
}
}
v[x] = aux;
}
else
{
bool ok = false;
for(const auto & el : v[x])
{
if(el == cx)
{
ok = true;
}
}
if(ok == true)fout << "1\n";
else fout << "0\n";
}
}
}