Pagini recente » Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #2508910) | Cod sursa (job #2539812) | Cod sursa (job #1946617)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int Mod = 666013;
ifstream f("hashuri.in"); ofstream g("hashuri.out");
vector <int> Hash[Mod];
int n;
int main() {
int i,c,j,x;
f>>n;
for(i = 1; i <= n; ++i) {
f>>c>>x;
if(c == 1) {
bool 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) {
bool ok = 0;
for(j = 0; j < Hash[x%Mod].size(); ++j) {
if(x == Hash[x%Mod][j]) {
ok = 1;
break;
}
}
g<<ok<<'\n';
}
}
return 0;
}