Pagini recente » Cod sursa (job #890675) | Cod sursa (job #1556925) | Cod sursa (job #1434446) | Cod sursa (job #2375664) | Cod sursa (job #402591)
Cod sursa(job #402591)
#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 ()));
}
}