Cod sursa(job #2746753)
| Utilizator | Data | 28 aprilie 2021 13:47:08 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <fstream>
#include <set>
using namespace std;
int n, k, nr = 1, h[200000], cod, x;
set <int> heap;
int main()
{
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin >> n;
for(int i = 0; i < n; i++)
{
fin >> cod;
if(cod == 1)
{
fin >> x;
heap.insert(x);
h[nr++] = x;
}
if(cod == 2)
{
fin >> x;
heap.erase(h[x]);
}
if(cod == 3)
{
fout << *heap.begin() << '\n';
}
}
return 0;
}
