Cod sursa(job #3378642)
| Utilizator | Data | 27 noiembrie 2026 10:43:19 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
set<int> s;
int n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
cin >> n;
for (int i = 0; i < n; ++i) {
int op, x;
cin >> op >> x;
if (op == 1 && s.find(x) == s.end())
s.insert(x);
else if (op == 2 && s.find(x) != s.end())
s.erase(x);
else if (op == 3){
if (s.find(x) != s.end()) cout << "1\n";
else cout << "0\n";
}
}
return 0;
}
