Cod sursa(job #1710579)
| Utilizator | Data | 29 mai 2016 12:29:45 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <stdio.h>
#include <stdlib.h>
#include <set>
using namespace std;
set<int> heap;
int n,x,y,v[200001],ord;
int main (){
freopen ("heapuri.in","r",stdin);
freopen ("heapuri.out","w",stdout);
scanf("%d",&n);
for(; n; --n){
scanf("%d",&x);
if(x==3){
printf("%d\n",*heap.begin());
continue;
}
scanf("%d",&y);
if(x==1){
heap.insert(y);
v[++ord]=y;
}
if(x==2){
heap.erase(v[y]);
}
}
return 0;
}
