Cod sursa(job #2214973)
| Utilizator | Data | 20 iunie 2018 17:09:04 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
int ordine[200001];
set <int> heap;
int main()
{
int n,i,tip,x,j = 0;
cin >> n;
for(i = 0;i < n;i++){
cin >> tip;
if(tip!=3)
cin >> x;
if(tip == 1){
ordine[++j] = x;
heap.insert(x);
}else if(tip == 2){
heap.erase(ordine[x]);
}else{
cout << *heap.begin() << "\n";
}
}
return 0;
}
