Pagini recente » Cod sursa (job #2758178) | Cod sursa (job #2401250) | Cod sursa (job #2482794) | Cod sursa (job #2734512) | Cod sursa (job #2618740)
#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;
}