Cod sursa(job #314073)
| Utilizator | Data | 10 mai 2009 15:34:37 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <cstdio>
#include <set>
#define maxN 200100
using namespace std;
int Poz[maxN], N, Nr;
multiset <int> S;
int main () {
int tip, x;
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
scanf("%d", &N);
for ( ; N -- ; ) {
scanf("%d", &tip);
if (tip < 3)
scanf("%d", &x);
if (tip == 1) {
S.insert(x);
Poz[ ++ Nr] = x;
} else if (tip == 2){
S.erase(S.find(Poz[x]));
} else
printf("%d\n", *(S.begin ()));
}
}
