Cod sursa(job #3020935)
| Utilizator | Data | 17 martie 2023 11:00:10 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <fstream>
#include <map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n, op, x, cnt;
map<int, int> mp;
int main() {
fin >> n;
for (int i = 1; i <= n; i++) {
fin >> op >> x;
if (op == 1) {
if (mp.find(x) == mp.end())
mp[x] = ++cnt;
} else if (op == 2) {
mp.erase(x);
} else {
fout << (mp.find(x) != mp.end()) << '\n';
}
}
return 0;
}