問題一覧 > 通常問題

No.2890 Chiffon

レベル : / AI推定難易度 : 2100 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 50
作問者 : 👑 seekworser / テスター : 👑 p-adic kemuniku
お気に入りにしたユーザー ProblemId : 11149 / 自分の提出
問題文最終更新日: 2024-08-30 16:49:55
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 446 (順位表) の他の問題:

Problem Statement

There is a circular cake. On its circumference, $2N$ points are placed at equal intervals, numbered $1, 2, \dots, 2N$ in clockwise order. Also, strawberries are placed at the positions of $K$ odd-numbered points $A_1, A_2, \dots, A_K$.

You will now choose $K$ even-numbered vertices and cut the cake along the rays from the center of the circle toward the chosen vertices, dividing it into $K$ pieces.

When the cutting points are chosen so that every piece has at least $1$ strawberry on it, find the maximum possible size of the smallest piece. Specifically, let $B_1, B_2, \dots, B_K$ be the chosen vertices in increasing order of number, and find the maximum value of $\displaystyle\min_{i=1,2,\dots,K} (B_{i+1} - B_i)$ (where $B_{K+1} = B_1 + 2N$).

It can be proved from the constraints of the problem that at least one way of cutting that satisfies the condition always exists.

Input

$N$ $K$
$A_1$ $A_2$ $\dots$ $A_K$

Constraints

  • $2 \le K \le N \le 5 \times 10^5$
  • $1 \le A_1 \lt A_2 \lt \dots \lt A_K \le 2N-1 \quad (1 \le i \le K)$
  • $A_i$ is odd for $i=1,2,\dots,K$
  • All inputs are integers

Output

Output the answer in $1$ line.

Sample

Sample 1
Input
6 3
1 7 11
Output
4

By making cuts at the positions of point $4$, point $8$, and point $12$, all pieces can be made to have size $4$.

Sample 2
Input
2 2
1 3
Output
2
Sample 3
Input
20 5
7 9 17 21 31
Output
6

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。