Pagini recente » Cod sursa (job #1401292) | Diferente pentru template/monthly-2012/header intre reviziile 4 si 5 | Cod sursa (job #1761519) | Diferente pentru preoni-2008/runda-finala/program intre reviziile 13 si 14 | Cod sursa (job #516903)
Cod sursa(job #516903)
#include <cstdio>
#include <set>
#define Nmax 200100
using namespace std;
int Poz[Nmax], L;
multiset <int> S;
int main () {
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
int N, tip, x;
for(scanf("%d",&N); N; --N) {
scanf("%d", &tip);
if(tip<3)
scanf("%d",&x);
if(tip==1) {
S.insert(x);
Poz[++L]=x;
}
else
if(tip==2)
S.erase(S.find(Poz[x]));
else
printf("%d\n",*S.begin());
}
}