Cod sursa(job #1275639)
| Utilizator | Data | 25 noiembrie 2014 14:06:53 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
# include <fstream>
# include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int i,j,n,x,y,VV;
int a[200005];
int main ()
{
f>>n;
multiset <int> heap;
for (i=1; i<=n; ++i)
{
f>>x;
if (x==1)
{
f>>a[++VV];
heap.insert(a[VV]);
}
else if (x==2)
{
f>>y;
heap.erase(heap.find(a[y]));
}
else g<<*heap.begin()<<"\n";
}
return 0;
}
