Cod sursa(job #2761771)
| Utilizator | Data | 3 iulie 2021 21:52:36 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include<iostream>
#include<fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main() {
set<int>heap;
int v[200001] = { 0 };
int n;
f >> n;
int comanda, x;
int k = 0;
for (int i = 1; i <= n; i++) {
f >> comanda;
if (comanda == 1) {
f >> x;
v[++k] = x;
heap.insert(x);
}
else {
if (comanda == 2) {
f >> x;
heap.erase(v[x]);
}
else {
if (comanda == 3)
g << *heap.begin() << "\n";;
}
}
}
f.close();
g.close();
return 0;
}
