Cod sursa(job #3005265)
| Utilizator | Data | 16 martie 2023 20:51:30 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 20 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int DIM = 200010;
int n, op, x;
int pos[DIM];
set<int> s;
int main() {
fin >> n;
for (int i = 1; i <= n; i++) {
fin >> op;
if (op == 1) {
fin >> x;
s.insert(x);
pos[s.size()] = x;
} else if (op == 2) {
fin >> x;
s.erase(pos[x]);
} else {
fout << *(s.begin()) << '\n';
}
}
return 0;
}