归并排序,模板
{
if (l >= r)return;
int mid = l + r >> 1;
bg(h, l, mid), bg(h, mid + 1, r);
int k = 0, i = l, j = mid + 1;
while (i <= mid && j <= r)
{
if (h[i] <= h[j]) te[k++] = h[i++];
else te[k++] = h[j++];
}
while (i <= mid) te[k++] = h[i++];
while (j <= r)te[k++] = h[j++];
for (i = l, j = 0; i <= r; i++, j++)
h[i] = te[j];
}