Cod sursa(job #2230517)
Utilizator | Data | 10 august 2018 13:49:35 | |
---|---|---|---|
Problema | Heapuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.5 kb |
#include<bits/stdc++.h>
using namespace std;
vector<int> v;
set<int> heap ;
int main(){
ifstream in("heapuri.in");
ofstream out("heapuri.out");
int n , option , x , op;
cin >> n ;
while(n--){
cin >> op ;
if(op == 1){
cin >> x ;
v.push_back(x);
heap.insert(x);
}
else if( op == 2 ){
cin >> x;
heap.erase(v[x-1]);
} else cout << *heap.begin()<<'\n';
}
}