Cod sursa(job #3030889)
Utilizator | Data | 17 martie 2023 22:45:51 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int DIM = 200010;
int n, op, x, cnt;
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[++cnt] = x;
} else if (op == 2) {
fin >> x;
s.erase(pos[x]);
} else {
fout << *(s.begin()) << '\n';
}
}
return 0;
}