結果

問題 No.1211 円環はお断り
ユーザー lam6er
提出日時 2025-04-16 15:48:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 81,892 KB
実行使用メモリ 85,192 KB
最終ジャッジ日時 2025-04-16 15:49:09
合計ジャッジ時間 4,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 = 1
high = total
ans = 0

while low <= high:
    mid = (low + high) // 2
    if total < k * mid:
        high = mid - 1
        continue
    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