Cod sursa(job #2618740)
| Utilizator | Data | 25 mai 2020 21:28:19 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <fstream>
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
set <int> heap;
vector <int> poz;
int main() {
ifstream f( "heapuri.in" );
ofstream g( "heapuri.out" );
int n, op, i, x;
f >> n;
for (i = 0; i < n; i ++) {
f >> op;
if ( op == 1 ) {
f >> x;
heap.insert(x);
poz.push_back(x);
} else if (op == 2) {
f >> x;
heap.erase(poz[x - 1]);
} else {
g << *(heap.begin()) << "\n";
}
}
return 0;
}
