Pagini recente » Borderou de evaluare (job #2978312) | Cod sursa (job #775293) | Cod sursa (job #544606) | Cod sursa (job #699299) | Cod sursa (job #2805717)
#include <fstream>
#include <vector>
#define mod 666013
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
vector<vector<int>>hashu(mod + 2);
vector <int> inter;
int n;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
int type, nr;
cin >> type >> nr;
int cat, rest;
cat = nr / mod;
rest = nr % mod;
bool ok = 0;
int loc = 0;
vector<int>::iterator itr, j;
for (j = hashu[rest].begin(); j != hashu[rest].end(); j++) {
if ((*j) == cat) {
ok = 1;
itr = j;
break;
}
}
if (type == 2) {
if (ok == 1) {
hashu[rest].erase(itr);
}
}
else if(type == 1){
if (ok == 0) {
hashu[rest].emplace_back(cat);
}
}
else if (type == 3) {
if (ok == 1) {
cout << 1 << '\n';
}
else {
cout << 0 << '\n';
}
}
}
}