Cod sursa(job #2396843)
| Utilizator | Data | 3 aprilie 2019 21:10:39 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.75 kb |
#include <fstream>
using namespace std;
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
#define maxn 200000
int heap[maxn],N,o,x,poz=0,mi=2000000000,poz2;
int main()
{
cin>>N;
for(int i=1; i<=N; i++){
cin>>o;
if(o==3){
if(heap[poz2]==1000000000){
mi=2000000000;
for(int i=1; i<=poz; i++)
if(heap[i]<mi&&heap[i]!=1000000000){
mi=heap[i];
poz2=i;
}
}
cout<<mi<<'\n';
}else if(o==2){
cin>>x;
heap[x]=1000000000;
}
else {
cin>>x;
heap[++poz]=x;
}
}
return 0;
}
