Cod sursa(job #2035405)
Utilizator | Data | 9 octombrie 2017 12:19:35 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
int n,test,x,i,k,v[200002],t;
multiset <int > heap;
int main(){
fin>>n;
for(i=1;i<=n;i++){
fin>>test;
if(test==3)
fout<<*heap.begin()<<"\n";
if(test==1){
fin>>x;
heap.insert(x);
v[++k]=x;
}
if(test==2){
fin>>x;
heap.erase(heap.find(v[x]));
}
}
}