Cod sursa(job #1089969)
| Utilizator | Data | 22 ianuarie 2014 09:29:43 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.66 kb |
#include <fstream>
#include <set>
const int NMAX=200001;
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,op,x,ord[NMAX],el,i;
int main()
{
multiset <int> heap;
f>>n;
for (i=1;i<=n;i++)
{
f>>op;
if (op==1)
{
f>>x;
heap.insert(x);
ord[++el]=x;
}
if (op==2)
{
f>>x;
heap.erase(heap.find(ord[x]));
}
if (op==3)
{
multiset <int> :: iterator it=heap.begin();
g<<*it<<'\n';
}
}
f.close();
g.close();
return 0;
}
