Cod sursa(job #1142890)
| Utilizator | Data | 14 martie 2014 13:01:12 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.88 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,t,v,nrc;
int x[200001];
multiset<int> heap;
int main()
{
f>>n;
for(int i=1;i<=n;i++)
{
f>>t;
switch(t)
{
case 1:
{
f>>v;
nrc++;
x[nrc]=v;
heap.insert(v);
break;
}
case 2:
{
f>>v;
multiset<int>::iterator it=heap.find(x[v]);
heap.erase(it);
break;
}
case 3:
{
multiset<int>::iterator it=heap.begin();
g<<*it<<"\n";
}
}
}
return 0;
}
