Cod sursa(job #2747906)
| Utilizator | Data | 29 aprilie 2021 18:50:00 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream fi("heapuri.in");
ofstream fo("heapuri.out");
set<int> heap;
int n, op, x, elheap[200001], j;
int main()
{
fi >> n;
for (int i = 0; i < n; i++){
fi >> op;
if (op == 1){
fi >> x;
heap.insert(x);
elheap[++j] = x;
} else if (op == 2){
fi >> x;
heap.erase(elheap[x]);
} else {
fo << *heap.begin() << '\n';
}
}
return 0;
}
