結果
問題 |
No.1211 円環はお断り
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:35:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 938 bytes |
コンパイル時間 | 142 ms |
コンパイル使用メモリ | 82,768 KB |
実行使用メモリ | 97,012 KB |
最終ジャッジ日時 | 2025-03-20 20:36:54 |
合計ジャッジ時間 | 4,954 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 WA * 5 |
ソースコード
def max_min_value(): import sys input = sys.stdin.read().split() N = int(input[0]) K = int(input[1]) A = list(map(int, input[2:2+N])) left = 0 right = sum(A) answer = 0 def is_possible(m): count = 0 current_sum = 0 for num in A: current_sum += num if current_sum >= m: count += 1 current_sum = 0 if count >= K: return True # For circular case, check the remaining part if it can wrap around (but the code is handled as linear) return count >= K while left <= right: mid = (left + right) // 2 if mid == 0: answer = mid left = mid + 1 continue if is_possible(mid): answer = mid left = mid + 1 else: right = mid - 1 print(answer) max_min_value()