Cod sursa(job #2900969)
| Utilizator | Data | 12 mai 2022 17:18:57 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
int main(){
int q , n = 0; fin >> q;
multiset<int>s;
vector<int>v;
while (q--){
int op , x; fin >> op;
if (op == 1){
fin >> x;
s.insert(x);
n += 1;
v.push_back(x);
}
if (op == 2){
fin >> x;
s.erase(v[x - 1]);
}
if (op == 3){
fout << *(s.begin()) << '\n';
}
}
}
