Cod sursa(job #879578)
| Utilizator | Data | 15 februarie 2013 17:28:02 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include<fstream>
#include<set>
#define dim 200007
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int a[dim],n,cnt,x,op,i;
multiset<int>h;
int main () {
f>>n;
for(i=1;i<=n;++i){
f>>op;
if(op==1){
f>>x;
a[++cnt]=x;
h.insert(a[cnt]);
}
if(op==2){
f>>x;
h.erase(a[x]);
}
if(op==3){
g<<*h.begin()<<"\n";
}
}
return 0;
}
