手写堆解法:
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn = 100100;
int a[maxn] = {
-1}; // 数组A
int b[maxn] = {
-1}; // 数组B
int heap[maxn];
int n = 0;
int N = 0;
void down_adjust(int low, int high){
int i = low, j = i * 2;
while(j <= high){
// 找到左右孩子中最小的一个