結果

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

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    N = int(input[0])
    K = int(input[1])
    A = list(map(int, input[2:2+N]))
    
    total = sum(A)
    low = 1
    high = total // K
    answer = 0
    
    while low <= high:
        mid = (low + high) // 2
        count = 0
        current = 0
        for num in A:
            current += num
            if current >= mid:
                count += 1
                current = 0
                if count >= K:
                    break
        if count >= K:
            answer = mid
            low = mid + 1
        else:
            high = mid - 1
    print(answer)
    
if __name__ == "__main__":
    main()
0