Cod sursa(job #547266)
Utilizator | Lepadat Mihai-Alexandru skull | Data | 6 martie 2011 08:40:20 |
---|---|---|---|
Problema | Heapuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
#include <stdio.h>
#include <set>
using namespace std;
#define nmax 200005
multiset<int> A;
int poz[nmax];
int N, nr;
int main ()
{
int i, tip, x;
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d", &N);
for (i = 1; i <= N; ++i)
{
scanf("%d", &tip);
if (tip == 1) { scanf("%d", &x); A.insert(x); poz[++nr] = x; }
else if (tip == 2) A.erase( A.find(poz[x]) );
else printf("%d\n", *A.begin());
}
return 0;
}