Cod sursa(job #2773314)
| Utilizator | Data | 6 septembrie 2021 13:22:00 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int>heap;
int n, opt, x, k = 0, v[200001];
int main() {
fin>>n;
for (int i = 0; i < n; ++i) {
fin>>opt;
if (opt == 1){
fin>>x;
heap.insert(x);
v[++k] = x;
}
else if (opt == 2){
fin>>x;
heap.erase(heap.find(v[x]));
}
else
fout<<*heap.begin()<<endl;
}
return 0;
}
