Pagini recente » Cod sursa (job #2330909) | Cod sursa (job #2924626) | Cod sursa (job #24228) | Cod sursa (job #1922812) | Cod sursa (job #2761799)
#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int main()
{
long long prim = 666013;
vector< vector<long long> >hash(prim);
int n;
f >> n;
long long op, x;
long long cod;
for (int i = 0; i < n; i++) {
f >> op >> x;
cod = x % prim;
if (op == 1) {
hash[cod].push_back(x);
}
if (op == 2) {
for (int j = 0; j < hash[cod].size(); j++) {
if (hash[cod][j] == x)
hash[cod].erase(hash[cod].begin() + j);
}
}
if (op == 3) {
int ok = 0;
for (int j = 0; j < hash[cod].size(); j++) {
if (hash[cod][j] == x) {
ok = 1;
g << ok << endl;
break;
}
}
if (ok == 0) {
g << ok << endl;
}
}
}
}