Cod sursa(job #1374475)
| Utilizator | Data | 5 martie 2015 09:33:28 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.65 kb |
#include <fstream>
#include <set>
#define DIM 200010
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int x, y, v[DIM], n, op;
multiset<int> heap;
int main()
{
fin >> n;
for(int i = 1; i <= n; i ++)
{
fin >> op;
if(op == 1)
{
fin >> x;
heap.insert(x);
v[++y] = x;
}
else
if(op == 2)
{
fin >> x;
heap.erase(v[x]);
}
else
{
fout << *heap.begin() << '\n';
}
}
return 0;
}
