Cod sursa(job #1424065)
Utilizator | Data | 23 aprilie 2015 12:39:20 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
multiset <int> h;
int v[200001],k,n,x,y,i;
int main()
{
f>>n;
for(i=1;i<=n;i++){
f>>x;
if(x==1)
{
f>>y;
h.insert(y);
v[++k]=y;
}
else{
if(x==2){
f>>y;
h.erase(h.find(v[y]));
}
else{
g<<*h.begin()<<'\n';}
}}
return 0;
}