Pagini recente » Cod sursa (job #3170117) | Cod sursa (job #2952035) | Cod sursa (job #866099) | Cod sursa (job #2572270) | Cod sursa (job #2237788)
#include <bits/stdc++.h>
using namespace std;
int num_operations;
set<int> myHeap;
vector<int> read_order;
int main() {
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin>>num_operations;
while(num_operations--) {
int operation_type;
fin>>operation_type;
if(operation_type==1) {
int value;
fin>>value;
read_order.push_back(value);
myHeap.insert(value);
} else if(operation_type==2) {
int index;
fin>>index;
myHeap.erase(read_order[index-1]);
} else {
fout<<*(myHeap.begin())<<'\n';
}
}
}