Cod sursa(job #1857020)
| Utilizator | Data | 25 ianuarie 2017 18:44:55 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.66 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
int n,i,v[200001],operatie,x,nr=0;
multiset <int> heap; multiset <int> ::iterator it;
f >> n;
for(i=1; i<=n; i++)
{
f >> operatie;
switch(operatie)
{
case 1:
f >> x;
heap.insert(x);
v[++nr] = x;
break;
case 2:
f >> x;
heap.erase(heap.find(v[x]));
break;
default:
it = heap.begin();
g << *it << '\n';
break;
}
}
return 0;
}
