Cod sursa(job #539568)
| Utilizator | Data | 23 februarie 2011 06:23:28 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
# include <cstdio>
# include <set>
using namespace std;
int poz[300001], m, n, tip, x;
multiset <int> rares;
int main ()
{ freopen("heapuri.in","r",stdin); freopen("heapuri.out","w",stdout);
for (scanf ("%d", &n); n; --n)
{ scanf ("%d", &tip);
if (tip == 1) {scanf ("%d", &x); rares.insert(x); poz[++m] = x;}
else if (tip == 2) {scanf ("%d", &x); rares.erase (rares.find (poz[x]));}
else printf ("%d\n", *rares.begin());
}
return 0;
}
