結果

問題 No.1211 円環はお断り
ユーザー titiatitia
提出日時 2020-08-30 17:32:22
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 82,228 KB
実行使用メモリ 101,216 KB
最終ジャッジ日時 2024-04-27 12:06:04
合計ジャッジ時間 4,977 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
60,332 KB
testcase_01 AC 33 ms
52,152 KB
testcase_02 AC 34 ms
52,416 KB
testcase_03 AC 35 ms
53,368 KB
testcase_04 AC 37 ms
52,892 KB
testcase_05 AC 36 ms
52,900 KB
testcase_06 AC 37 ms
52,320 KB
testcase_07 AC 61 ms
74,092 KB
testcase_08 AC 35 ms
53,176 KB
testcase_09 AC 71 ms
76,236 KB
testcase_10 AC 55 ms
73,304 KB
testcase_11 AC 72 ms
76,360 KB
testcase_12 AC 48 ms
66,184 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

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*3
SUM=[0]
for a in B:
    SUM.append(SUM[-1]+a)

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

    flag=0
    for start in range(min(N//K+100,N%K+100)):
        if start>N:
            break
        G=0
        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