結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
59,576 KB
testcase_01 AC 37 ms
52,456 KB
testcase_02 AC 38 ms
52,372 KB
testcase_03 AC 39 ms
52,476 KB
testcase_04 AC 41 ms
51,964 KB
testcase_05 AC 38 ms
52,312 KB
testcase_06 AC 38 ms
53,304 KB
testcase_07 AC 50 ms
64,112 KB
testcase_08 AC 39 ms
52,636 KB
testcase_09 AC 62 ms
75,788 KB
testcase_10 AC 49 ms
63,716 KB
testcase_11 AC 64 ms
75,836 KB
testcase_12 AC 54 ms
65,564 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+20,N%K+20)):
        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