Pagini recente » Cod sursa (job #720681) | Cod sursa (job #1290466) | Cod sursa (job #2897568) | Cod sursa (job #2201168) | Cod sursa (job #402590)
Cod sursa(job #402590)
#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 ()));
}
}