Pagini recente » Cod sursa (job #2183081) | Cod sursa (job #1573904) | Cod sursa (job #3289384) | Cod sursa (job #2584318) | Cod sursa (job #2812603)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
const int mod = 7e5 + 1;
vector <int> h[mod+5];
int get(int rest, int x) {
for(int i = 0; i < h[rest].size(); ++i)
if(h[rest][i] == x)
return i;
return -1;
}
int main()
{
int n; fin >> n;
for(int i = 1; i <= n; ++i) {
int op, x; fin >> op >> x;
int rest = x % mod;
if(op == 1) {
if(get(rest, x) == -1)
h[rest].push_back(x);
} else if(op == 2) {
int i = get(rest, x);
if(i != -1) h[rest].erase(h[rest].begin()+i);
} else {
int i = get(rest, x);
if(i != -1) fout << "1\n";
else fout << "0\n";
}
}
return 0;
}