logo AlgoBeat OnlineJudge
登录 注册

#215278. [USACO26JAN2] Circle of Cows P

内存限制:256 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Farmer John has () cows at distinct locations along a circle of circumference ().

FJ will select pairs of cows, where , 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 , help FJ determine the maximum possible minimum distance.

输入格式

The first line contains and .

The second line contains .

输出格式

Output a single line with space-separated integers, with the answers for in that order.

样例

样例输入 1

4 100
0 25 50 75

样例输出 1

50 50

样例输入 2

4 100
0 1 2 99

样例输出 2

3 2

数据范围与提示

Sample 1 Explanation

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

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

Sample 2 Explanation

For , cow 3 can be paired to cow 4, which is distance away from it along the circumference of the circle, making the answer .

For , 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 from each other along the circumference of the circle, making the answer .

SCORING:

  • Inputs 3-4:
  • Inputs 5-6:
  • Inputs 7-14:
  • Inputs 15-22: No additional constraints.