Cod sursa(job #2221587)
| Utilizator | Data | 14 iulie 2018 22:22:50 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> heap;
int n, cer, x, v[200002], ind;
int main()
{
fin >> n;
for (int i = 1; i <= n; ++i)
{
fin >> cer;
if (cer == 1)
{
fin >> x;
v[++ind] = x;
heap.insert(x);
}
else if (cer == 2)
{
fin >> x;
heap.erase(heap.find(v[x]));
}
else
fout << *heap.begin() << '\n';
}
fin.close();
fout.close();
return 0;
}
