Cod sursa(job #2747758)
| Utilizator | Data | 29 aprilie 2021 16:57:25 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int pos[200001];
int main(){
set <int> heap;
int n, cod, x, count = 0;
f >> n;
for (int i = 0 ; i < n; i++){
f >> cod;
switch(cod){
case 1:
f >> x;
heap.insert(x);
pos[++count] = x;
break;
case 2:
f >> x;
heap.erase(pos[x]);
break;
case 3:
g << *heap.begin() << "\n";
}
}
return 0;
}