Cod sursa(job #1315431)
| Utilizator | Data | 12 ianuarie 2015 20:20:48 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.69 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> heap;
int n, x, y, V[100010], i;
int main()
{
fin >> n;
int poz = 1;
for(i = 1; i <= n;i ++)
{
fin >> x;
if(x == 1)
{
fin >> y;
heap.insert(y);
V[poz] = y;
poz ++;
}
else
if(x == 2)
{
fin >> y;
heap.erase(V[y]);
}
else
fout << *heap.begin() << '\n';
}
return 0;
}
