Pagini recente » Cod sursa (job #1915533) | Cod sursa (job #1804550) | Cod sursa (job #1183062) | Cod sursa (job #354898) | Cod sursa (job #2081641)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <set>
using namespace std;
ifstream f ("hashuri.in");
ofstream g ("hashuri.out");
set <int> s;
bool contine(int x) {
return s.find(x) != s.end();
}
void adauga(int x) {
if (!contine(x)) s.insert(x);
}
void sterge(int x) {
if (contine(x)) s.erase(s.find(x));
}
int main() {
int n, k, x, op;
f >> n;
k = 0;
while (n--) {
f >> op >> x;
if (op == 1) {
adauga(x);
continue;
}
if (op == 2) {
sterge(x);
continue;
}
g << contine(x) << '\n';
}
return 0;
}