Cod sursa(job #775205)
| Utilizator | Data | 7 august 2012 15:21:09 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include<fstream>
#include<set>
#define Nmax 200010
using namespace std;
multiset <int> v;
int n, i, x, a, poz[Nmax], nr;
int main()
{
ifstream f("heapuri.in");
ofstream h("heapuri.out");
f>>n;
for (i=1; i<=n; ++i)
{
f>>x;
if (x==3)
h<<*v.begin()<<'\n';
else
if (x==1)
{
f>>a;
v.insert(a);
poz[++nr]=a;
}
else
if (x==2)
{
f>>a;
v.erase(v.find(poz[a]));
}
}
f.close();
h.close();
return 0;
}
