Cod sursa(job #539435)
| Utilizator | Data | 22 februarie 2011 22:31:46 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 10 |
| 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;
set <int> rares;
int main ()
{ freopen("heapuri.in","r",stdin); freopen("heapuri.out","w",stdout);
scanf ("%d", &n);
for (; 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;
}
