Cod sursa(job #2374216)
| Utilizator | Data | 7 martie 2019 17:32:00 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
int v[200005];
set<int> S;
int main(){
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
int n;
scanf("%d",&n);
for(int i=1;i<=n;++i){
int tip;
scanf("%d",&tip);
if(tip==1){
scanf("%d",&v[++v[0]]);
S.insert(v[v[0]]);
}
else if(tip==2){
int x;
scanf("%d",&x);
S.erase(v[x]);
}
else printf("%d\n",*S.begin());
}
return 0;
}
