Cod sursa(job #2444053)
| Utilizator | Data | 30 iulie 2019 10:18:29 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
multiset <int> my_set;
vector <int> inserted;
int main(){
int n,i,x,y;
f >> n;
while(n--){
f >> x;
if(x == 1){
f >> y;
inserted.push_back(y);
my_set.insert(y);
}else
if(x == 2){
f >> y;
my_set.erase(inserted[y - 1]);
}else{
multiset <int> :: iterator it = my_set.begin();
g << *it << "\n";
}
}
return 0;
}
