Pagini recente » Cod sursa (job #2984208) | Cod sursa (job #567446) | Cod sursa (job #2243718) | Cod sursa (job #1168715) | Cod sursa (job #2739004)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int N = 999983;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> v[N+5];
int main() {
int n, x, op;
fin >> n;
for(int i=0; i<N; ++i)
v[i] = vector<int>();
for(int i=0; i<n; ++i)
{
fin >> op >> x;
int y = x%N;
int gasit = 0;
vector<int>::iterator it;
for (it = v[y].begin(); it != v[y].end(); ++it)
if(*it == x)
{
gasit = 1;
break;
}
if(op == 1 ) {
if(gasit == 0)
v[y].push_back(x);
}
else if(op == 2)
{
if(gasit == 1)
{
v[y].erase(it);
}
}
else
{
fout << gasit << "\n";
}
}
return 0;
}