Pagini recente » Cod sursa (job #40748) | Cod sursa (job #786314) | Cod sursa (job #402585) | Cod sursa (job #1850314) | Cod sursa (job #402593)
Cod sursa(job #402593)
#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("%u", &tip);
if (tip < 3)
scanf("%u", &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 ()));
}
}