Cod sursa(job #1882529)
| Utilizator | Data | 17 februarie 2017 12:02:52 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
const int NMax = 200001;
multiset<int> H;
int n,p,x,nr;
int a[NMax];
int main()
{
f >> n;
for(int i = 1; i <= n; ++i){
f >> p;
if(p == 1){
f >> x;
H.insert(x);
a[++nr] = x;
}if(p == 2){
f >> x;
H.erase(a[x]);
}if(p == 3)
g << (*H.begin()) << '\n';
}
return 0;
}
