Cod sursa(job #2622481)
| Utilizator | Data | 1 iunie 2020 13:14:36 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <fstream>
#include <vector>
#include <set>
int main() {
std::ifstream f("heapuri.in");
std::ofstream g("heapuri.out");
std::set<int> v;
std::vector<int> ord;
int command, n, tmp;
f >> n;
for (int i = 0; i < n; i++) {
f >> command;
if (command == 1) {
f >> tmp;
v.insert(tmp);
ord.push_back(tmp);
}
if (command == 2) {
f >> tmp;
v.erase(ord[tmp - 1]);
}
if (command == 3) {
g << *v.begin() << "\n";
}
}
}