Cod sursa(job #2230521)
Utilizator | Data | 10 august 2018 13:51:47 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.48 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 , x , op;
in >> n ;
while(n--){
in >> op ;
if(op == 1){
in >> x ;
v.push_back(x);
heap.insert(x);
}
else if( op == 2 ){
in >> x;
heap.erase(v[x-1]);
} else out << *heap.begin()<<'\n';
}
}