Cod sursa(job #2747546)
| Utilizator | Data | 29 aprilie 2021 13:11:35 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set <int> heap;
int N, poz[200010], m, cod, x, i;
int main()
{
f>>N;
for(i = 1; i <= N; i++)
{
f >> cod;
if(cod == 1)
{
f >> x;
heap.insert(x);
poz[++m] = x;
}
else if(cod == 2)
{
f >> x;
heap.erase(poz[x]);
}
else
g << *heap.begin() << '\n';
}
return 0;
}
