Cod sursa(job #1787348)
| Utilizator | Data | 24 octombrie 2016 15:29:37 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <bits/stdc++.h>
using namespace std;
int main() {
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
cin.tie(0);
ios_base::sync_with_stdio(false);
int n; cin >> n;
unordered_set<int> m_hash;
//m_hash.reserve(1 << 20);
//m_hash.max_load_factor(0.25);
while (n--) {
int op_type, x; cin >> op_type >> x;
if (op_type == 1) {
m_hash.insert(x);
} else if (op_type == 2) {
m_hash.erase(x);
} else {
cout << (m_hash.find(x) != m_hash.end()) << '\n';
}
}
return 0;
}