Cod sursa(job #656287)
| Utilizator | Data | 4 ianuarie 2012 13:55:32 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <cstdio>
#include <set>
using namespace std;
#define maxN 20005
set <int> a;
int poz[maxN] , N;
int main ()
{
freopen ("heapuri.in" , "r" , stdin);
freopen ("heapuri.out" , "w" , stdout);
scanf ("%d" , &N);
int cod , dim = 0 , x;
for (int i = 1 ; i <= N ; ++i)
{
scanf ("%d" , &cod);
if (cod == 1)
{
scanf ("%d" , &x);
poz[++dim] = x;
a.insert (x);
}
else if (cod == 2)
{
scanf ("%d" , &x);
a.erase (a.find (poz[x]));
}
else
printf ("%d\n" , *a.begin());
}
return 0;
}
