No.2890 Chiffon
タグ : / 解いたユーザー数 50
作問者 : 👑
kemuniku
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もしくは右上の雲マークをクリックしてアカウントを作成してください。