Cod sursa(job #2616078)
Utilizator | Lorintz Alexandru Alex_tz307 | Data | 16 mai 2020 16:35:51 |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.52 kb |
#include <bits/stdc++.h>
#define maxn 200005
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
set < int > heap;
int n, poz[maxn], k, a, x;
int main() {
fin >> n;
for (int i = 1; i <= n; ++i) {
fin >> x;
if (x == 1) {
fin >> a;
heap.insert (a);
poz[++k] = a;
} else if (x == 2) {
fin >> a;
heap.erase (poz[a]);
} else fout << *heap.begin() << '\n';
}
return 0;
}