結果

問題 No.1211 円環はお断り
ユーザー gew1fw
提出日時 2025-06-12 21:26:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 85,760 KB
最終ジャッジ日時 2025-06-12 21:28:23
合計ジャッジ時間 5,026 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
total = sum(a)

low = 0
high = total // k
ans = 0

while low <= high:
    mid = (low + high) // 2
    current = 0
    count = 0
    for num in a:
        current += num
        if current >= mid:
            count += 1
            current = 0
    if count >= k:
        ans = mid
        low = mid + 1
    else:
        high = mid - 1

print(ans)
0