結果
問題 |
No.1211 円環はお断り
|
ユーザー |
|
提出日時 | 2024-07-13 15:00:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 850 ms / 2,000 ms |
コード長 | 692 bytes |
コンパイル時間 | 354 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 108,676 KB |
最終ジャッジ日時 | 2024-07-13 15:00:35 |
合計ジャッジ時間 | 16,262 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
from bisect import bisect_left, bisect_right from itertools import accumulate n, k = map(int, input().split()) nums = list(map(int, input().split())) preSum = [0] + list(accumulate(nums + nums)) def check(mid: int) -> bool: max_ = bisect_right(preSum, mid) for start in range(max_): if start > n: break cur = start for _ in range(k): cur = bisect_left(preSum, preSum[cur] + mid) if cur > start + n: break else: return True return False l, r = 0, (sum(nums) // k) + 1 while l <= r: mid = (l + r) // 2 if check(mid): l = mid + 1 else: r = mid - 1 print(r)