Cod sursa(job #3350598)
| Utilizator | Data | 10 aprilie 2026 22:45:35 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.66 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
#define N 200005
int main(){
multiset<ll> h;
int n, cnt = 0;
ll a[N] = { 0 };
fin >> n;
while(n--){
int c;
fin >> c;
if(c < 3){
int x;
fin >> x;
if(c == 1){
h.insert(x);
a[++cnt] = x;
}
if(c == 2){
h.erase(a[x]);
}
}
else{
multiset <ll> :: iterator it = h.begin();
fout << *it << '\n';
}
}
return 0;
}