結果
問題 |
No.1211 円環はお断り
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:38:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 82,288 KB |
実行使用メモリ | 96,664 KB |
最終ジャッジ日時 | 2025-06-12 16:38:05 |
合計ジャッジ時間 | 5,476 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 WA * 5 |
ソースコード
def main(): import sys input = sys.stdin.read data = input().split() N = int(data[0]) K = int(data[1]) A = list(map(int, data[2:2 + N])) total = sum(A) low = 0 high = total def is_possible(M): current_sum = 0 count = 0 for num in A: current_sum += num if current_sum >= M: count += 1 current_sum = 0 if count == K: return True return count == K and current_sum >= M while low < high: mid = (low + high + 1) // 2 if is_possible(mid): low = mid else: high = mid - 1 print(low) if __name__ == "__main__": main()