Cod sursa(job #516902)
| Utilizator | Data | 26 decembrie 2010 22:23:01 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#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());
}
}