Cod sursa(job #603968)
| Utilizator | Data | 19 iulie 2011 16:12:12 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <cstdio>
#include <set>
using namespace std;
int n, tip, x, nh=0,v[200010];
multiset <int, less<int> > heap;
int main(){
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d\n",&n);
for (int i=1;i<=n;i++){
scanf("%d", &tip);
if (tip==3) printf("%d\n",*heap.begin()),scanf("\n");
if (tip==1) {scanf("%d\n",&x);heap.insert(x);++nh;v[nh]=x;}
if (tip==2) scanf("%d\n",&x),heap.erase(v[x]);
}
return 0;
}
