結果

問題 No.1211 円環はお断り
ユーザー titiatitia
提出日時 2020-08-30 17:38:23
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 874 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 106,252 KB
最終ジャッジ日時 2023-08-15 10:08:56
合計ジャッジ時間 18,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,020 KB
testcase_01 AC 78 ms
71,212 KB
testcase_02 AC 78 ms
71,216 KB
testcase_03 AC 76 ms
71,196 KB
testcase_04 AC 77 ms
71,292 KB
testcase_05 AC 78 ms
71,272 KB
testcase_06 AC 80 ms
71,312 KB
testcase_07 AC 85 ms
75,496 KB
testcase_08 AC 77 ms
71,316 KB
testcase_09 AC 86 ms
76,388 KB
testcase_10 AC 86 ms
76,160 KB
testcase_11 AC 86 ms
76,296 KB
testcase_12 AC 78 ms
75,188 KB
testcase_13 AC 371 ms
90,768 KB
testcase_14 AC 635 ms
96,380 KB
testcase_15 AC 440 ms
96,192 KB
testcase_16 AC 698 ms
106,252 KB
testcase_17 AC 149 ms
77,748 KB
testcase_18 AC 442 ms
93,712 KB
testcase_19 AC 185 ms
78,100 KB
testcase_20 AC 176 ms
78,616 KB
testcase_21 AC 156 ms
78,164 KB
testcase_22 AC 529 ms
91,472 KB
testcase_23 AC 613 ms
94,024 KB
testcase_24 AC 345 ms
85,408 KB
testcase_25 AC 121 ms
77,772 KB
testcase_26 AC 500 ms
97,616 KB
testcase_27 AC 342 ms
85,524 KB
testcase_28 AC 683 ms
97,716 KB
testcase_29 AC 446 ms
93,856 KB
testcase_30 AC 611 ms
99,188 KB
testcase_31 AC 274 ms
84,104 KB
testcase_32 AC 758 ms
102,616 KB
testcase_33 AC 808 ms
106,060 KB
testcase_34 AC 854 ms
106,036 KB
testcase_35 AC 837 ms
106,076 KB
testcase_36 AC 828 ms
106,112 KB
testcase_37 AC 830 ms
106,044 KB
testcase_38 AC 874 ms
105,968 KB
testcase_39 AC 868 ms
106,160 KB
testcase_40 AC 116 ms
105,732 KB
testcase_41 AC 76 ms
71,428 KB
testcase_42 AC 77 ms
71,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import bisect

N,K=map(int,input().split())
A=list(map(int,input().split()))

OK=0
NG=sum(A)//K+1
B=A*2
SUM=[0]
for a in B:
    SUM.append(SUM[-1]+a)

while NG-OK>1:
    mid=(OK+NG)//2

    flag=0
    MAX=bisect.bisect_right(SUM,mid)
    for start in range(MAX):
        if start>N:
            break
        now=start

        for j in range(K):
            now=bisect.bisect_left(SUM,SUM[now]+mid)
            if now>start+N:
                break
        if now<=start+N:
            flag=1
            break

    if flag:
        OK=mid
    else:
        NG=mid
print(OK)
0