Cod sursa(job #2135882)
| Utilizator | Data | 19 februarie 2018 13:32:13 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.52 kb |
#include<bits/stdc++.h>
using namespace std;
set<int>h;
int v[200010];
int main(){
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
int i,nr=0,n,p,x;
scanf("%d",&n);
for (i=1;i<=n;i++){
scanf("%d",&p);
if (p==1){
scanf("%d",&v[++nr]);
h.insert(v[nr]);
}
if (p==2){
scanf("%d",&x);
h.erase(v[x]);
}
if (p==3){
printf("%d\n",*h.begin());
}
}
}
