Pagini recente » Cod sursa (job #1672184) | Cod sursa (job #1947150) | Cod sursa (job #2617089) | Cod sursa (job #1666448) | Cod sursa (job #3129990)
#include<iostream>
#include<fstream>
#include<unordered_map>
using namespace std;
int main() {
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,i,op,nr;
unordered_map<int, int> hash;
f >> n;
for (i = 0;i < n;i++) {
f >> op;
f >> nr;
if (op == 1) {
if (hash.count(nr) == 0) {
hash[nr] = 1;
}
}
if (op == 2) {
if (hash.count(nr) == 1) {
hash.erase(nr);
}
}
if (op == 3) {
if (hash.count(nr) !=0) {
g << "1" << endl;
}
else {
g << "0" << endl;
}
}
}
}