#5412. Problem 1. Circle of Cows

0

Problem 1. Circle of Cows

Problem 1. Circle of Cows

USACO 2026 Second Contest, Platinum

Farmer John has NN (2N10002\le N\le 1000) cows at distinct locations l1,,lNl_1,\dots, l_N along a circle of circumference CC (0l1<l2<<lN<C,NC1090\le l_1 < l_2 < \dots < l_N <C, N\le C\le 10^9).

FJ will select kk pairs of cows, where 1kN/21\le k\le \lfloor N/2\rfloor, and no cow is selected more than once. He wants to select the pairs such that the minimum distance between any two cows in the same pair along the circumference of the circle is maximized.

For each value of kk, help FJ determine the maximum possible minimum distance.

INPUT FORMAT (input arrives from the terminal / stdin):

The first line contains NN and CC.

The second line contains l1lNl_1\dots l_N.

OUTPUT FORMAT (print output to the terminal / stdout):

Output a single line with N/2\lfloor N/2\rfloor space-separated integers, with the answers for k=1N/2k=1\dots \lfloor N/2\rfloor in that order.

SAMPLE INPUT:


4 100
0 25 50 75

SAMPLE OUTPUT:


50 50

For k=1k = 1, cow 1 can be paired to cow 3, which is distance 5050 away along the circumference of the circle, making the answer 5050.

For k=2k = 2, cow 1 can be paired to cow 3, and cow 2 can be paired to cow 4, which is distance 5050 away from it along the circumference of the circle, making the answer still 5050.

SAMPLE INPUT:


4 100
0 1 2 99

SAMPLE OUTPUT:


3 2

For k=1k = 1, cow 3 can be paired to cow 4, which is distance 2+10099=32 + 100 - 99 = 3 away from it along the circumference of the circle, making the answer 33.

For k=2k = 2, cow 1 can be paired to cow 3 and cow 2 can be paired to cow 4. Each of these pairs contains two cows at a distance of 22 from each other along the circumference of the circle, making the answer 22.

SCORING: Inputs 3-4: 2lNC2l_N \le CInputs 5-6: N20N\le 20Inputs 7-14: N100N\le 100Inputs 15-22: No additional constraints.

Problem credits: Benjamin Qi