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