Pagini recente » Cod sursa (job #792702) | Cod sursa (job #1831955) | Cod sursa (job #2723256) | Cod sursa (job #2151959) | Cod sursa (job #1969417)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
ifstream f("hashuri.in"); ofstream g("hashuri.out");
const int Mod = 666013;
vector <int> Hash[Mod];
int n, c, x;
int main() {
int i;
f>>n;
for(i = 1; i <= n; ++i) {
bool ok;
int j;
f>>c>>x;
if (c == 1) {
ok = 1;
for(j = 0; j < Hash[x % Mod].size(); ++j) {
if (x == Hash[x % Mod][j]) {
ok = 0;
break;
}
}
if (ok) {
Hash[x % Mod].push_back(x);
}
}
if (c == 2) {
for(j = 0; j < Hash[x % Mod].size(); ++j) {
if (x == Hash[x % Mod][j]) {
Hash[x % Mod][j] = 0;
break;
}
}
}
if (c == 3) {
ok = 0;
for(j = 0; j < Hash[x % Mod].size(); ++j) {
if (x == Hash[x % Mod][j]) {
ok = 1;
break;
}
}
if (ok) {
g<<1<<'\n';
}
else {
g<<0<<'\n';
}
}
}
return 0;
}