Cod sursa(job #1193454)
| Utilizator | Data | 31 mai 2014 19:54:09 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <cstdio>
#include <set>
using namespace std;
#define NMAX 200001
set < int > S;
int Q,type,X;
int Enter[NMAX];
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&Q);
while (Q--)
{
scanf("%d",&type);
if (type==1)
{
scanf("%d",&X);
Enter[++Enter[0]]=X;
S.insert(X);
continue;
}
if (type==2)
{
scanf("%d",&X);
S.erase(Enter[X]);
continue;
}
printf("%d\n",*S.begin());
}
return 0;
}
