Cod sursa(job #2743993)
| Utilizator | Data | 23 aprilie 2021 19:54:33 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <bits/stdc++.h>
using namespace std;
int n, cod, x;
set <int> heap;
vector <int> ordine;
ifstream in ("heapuri.in");
ofstream out ("heapuri.out");
int main()
{
in >> n;
for(int i = 0; i < n; ++i)
{
in >> cod;
if(cod == 1)
{
in >> x;
heap.insert(x);
ordine.push_back(x);
}
else if(cod == 2)
{
in >> x;
heap.erase(ordine[x - 1]);
}
else
out << *heap.begin() << "\n";
}
return 0;
}
