Login
Register
Problem list
Online status
LLSSYY
:
2025-09-28 19:48:22
def down(arr, i): l = i * 2 r = i * 2 + 1 mn = l if (l < len(arr) and arr[l] < arr[i]) else i mn = r if (r < len(arr) and arr[r] < arr[mn]) else mn if mn != i: arr[i], arr[mn] = arr[mn], arr[i] down(arr, mn) m = int(input()) for i in range(m): data = list(map(int, input().split())) n, arr = data[0], data[1:] arr = [-1] + arr for j in range((len(arr) - 1) // 2, 0, -1): down(arr, j) print(" ".join(map(str, arr[1:])))
0Lway0
:
2024-09-22 10:38:18
No matter the sequence to which subtree, the first example's output should be 1 3 2 8 6 4 3.
212050胡昱
:
2021-10-19 16:22:51
So how can our program get Accepted?
GoldenPi
:
2021-03-02 21:06:48
No matter the sequence to which subtree, the first example's output should be 1 3 2 8 6 4 3.
bxx_GoodGod
:
2020-11-25 15:32:29
不用管那个捞什子“优先调整左子树”
zcw8887
:
2020-11-08 15:25:51
There are some mistakes in this problem. Firstly, the problem requires 8
Post Your Comment