Cod sursa(job #1129930)
| Utilizator | Data | 28 februarie 2014 10:20:29 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 kb |
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
multiset <int> m;
int ord[200000];
int n;
int main()
{
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
int k=0,cod,x;
scanf("%d",&n);
for (int i=0;i<n;++i)
{
scanf("%d",&cod);
if (cod==1)
{
scanf("%d",&x);
ord[++k]=x;
m.insert(x);
}
else if (cod==2)
{
scanf("%d",&x);
m.erase(m.find(ord[x]));
}
else
{
printf("%d\n",*m.begin());
}
}
return 0;
}
