結果
問題 |
No.2890 Chiffon
|
ユーザー |
![]() |
提出日時 | 2024-09-13 22:26:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 82,136 KB |
実行使用メモリ | 118,428 KB |
最終ジャッジ日時 | 2024-09-13 22:26:38 |
合計ジャッジ時間 | 5,542 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 WA * 4 |
ソースコード
N, K = map(int, input().split()) A = [(int(x) - 1) // 2 for x in input().split()] A.append(A[0] + N) def check2(x, y, last): pos = -y for i in range(K): if (i < K - 1 or last) and pos + x >= A[i + 1]: return False pos = max(A[i], pos + x) return True def check(x): d = A[K] - A[K - 1] ng = 0 ok = d + 1 while ok - ng > 1: mid = (ok + ng) // 2 if check2(x, mid, False): ok = mid else: ng = mid return ok <= d and check2(x, ok, True) ok = 1 ng = 10 ** 18 while ng - ok > 1: mid = (ok + ng) // 2 if check(mid): ok = mid else: ng = mid print(ok * 2)