9596: Bernoulli's Principle

内存限制:512 MB 时间限制:2 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Bernoulli's principle is a definition in fluid mechanics, stating that the total sum of kinetic energy, potential energy and internal energy of a fluid remains constant. Torricelli's law is a particular case of Bernoulli's principle, stating that when a liquid flows out from a small hole at the surface of a container, its initial velocity is √(2gh), where h is the height difference from the center of the hole to the highest point of the liquid surface, and g is the gravitational acceleration.

Now, a cylindrical container filled with liquid is placed vertically on a horizontal plane, and the liquid is continuously and slowly added to keep the height of the surface constant. On the side of the cylinder are n small holes (numbered from 1 to n) through which liquid is flowing out. The liquid flow undergoes free fall in the vertical direction with an initial velocity of 0 and acceleration of g (the horizontal initial velocity is as mentioned above). Given the height of the liquid surface and the height differences from the center of each small hole to the horizontal plane, please analyze the horizontal distance that the liquid from each hole travels before reaching the plane, and sort these n small holes based on the size of this distance.

输入格式

The first line contains an integer T (1 ≤ T ≤ 10⁵), indicating the number of test cases. Then follow T test cases. For each test case: The first line contains two integers n and H (1 ≤ n ≤ 10⁵, 2 ≤ H ≤ 10⁹), representing the number of holes and the height of the liquid surface. The second line contains n integers h₁, h₂, ..., hₙ (1 ≤ hᵢ < H), where the i-th number represents the height difference from hole number i to the horizontal plane. It is guaranteed that the total sum of n over T test cases does not exceed 10⁶.

输出格式

For each test case, output nnn integers in one line, representing the indices of the nnn holes sorted in non-decreasing order based on their horizontal movement distances. If there are multiple possible outputs, any of them is acceptable.

输入样例 复制

2
5 10
1 3 5 7 9
5 20
1 3 5 7 9

输出样例 复制

1 5 2 4 3
1 2 3 4 5