Cod sursa(job #2650856)
| Utilizator | Data | 20 septembrie 2020 15:15:10 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
#define NMAX 200010
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int ordine[NMAX];
set < int > heap;
int main() {
int n, ord = 0;
f >> n;
for (int i = 0; i < n; i++) {
int op, x;
f >> op;
if (op == 1) {
f >> x;
heap.insert(x);
ordine[ord++] = x;
} else if (op == 2) {
f >> x;
heap.erase(ordine[x]);
} else {
g << * (heap.begin()) << "\n";
}
}
return 0;
}
