Cod sursa(job #2747544)
Utilizator | Data | 29 aprilie 2021 13:06:03 | |
---|---|---|---|
Problema | Heapuri | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
// https://tutoriale-pe.net/structuri-de-date-heapuri-c/
ifstream f("heapuri.in");
ofstream o("heapuri.out");
int n, poz[200005], k, a, x;
set<int> heap;
f >> n;
if(x == 1){
f >> a;
heap.insert(a);
poz[++k] = a;
}
else if(x == 2)
{
f >> a;
heap.erase(poz[a]);
}
else{
o << *heap.begin() << '\n';
}
return 0;
}