結果

問題 No.2217 Suffix+
ユーザー titiatitia
提出日時 2023-02-17 22:26:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 91,620 KB
最終ジャッジ日時 2023-09-26 19:42:51
合計ジャッジ時間 6,576 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,416 KB
testcase_01 AC 71 ms
71,156 KB
testcase_02 AC 71 ms
71,232 KB
testcase_03 AC 71 ms
71,252 KB
testcase_04 AC 73 ms
71,248 KB
testcase_05 AC 72 ms
71,352 KB
testcase_06 AC 71 ms
71,240 KB
testcase_07 AC 70 ms
71,252 KB
testcase_08 AC 70 ms
71,372 KB
testcase_09 AC 69 ms
71,300 KB
testcase_10 AC 69 ms
71,424 KB
testcase_11 AC 71 ms
71,304 KB
testcase_12 AC 71 ms
71,048 KB
testcase_13 AC 69 ms
71,008 KB
testcase_14 AC 88 ms
78,428 KB
testcase_15 AC 90 ms
78,372 KB
testcase_16 AC 97 ms
83,040 KB
testcase_17 AC 94 ms
80,580 KB
testcase_18 AC 91 ms
79,828 KB
testcase_19 AC 182 ms
86,848 KB
testcase_20 AC 174 ms
85,392 KB
testcase_21 AC 97 ms
76,456 KB
testcase_22 AC 179 ms
86,944 KB
testcase_23 AC 163 ms
83,056 KB
testcase_24 AC 121 ms
91,292 KB
testcase_25 AC 116 ms
91,256 KB
testcase_26 AC 118 ms
91,256 KB
testcase_27 AC 116 ms
91,420 KB
testcase_28 AC 122 ms
91,296 KB
testcase_29 AC 219 ms
91,552 KB
testcase_30 AC 218 ms
91,592 KB
testcase_31 AC 223 ms
91,560 KB
testcase_32 AC 219 ms
91,488 KB
testcase_33 AC 220 ms
91,620 KB
testcase_34 AC 115 ms
91,372 KB
testcase_35 AC 70 ms
71,248 KB
testcase_36 AC 258 ms
91,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

OK=0
NG=10**18

while NG>OK+1:
    mid=(OK+NG)//2
    c=0
    p=0

    for i in range(N):
        if A[i]+c<mid:
            u=mid-A[i]-c
            x=i+1

            k=(u+x-1)//x
            p+=k
            c+=k*x
    if p<=K:
        OK=mid
    else:
        NG=mid
print(OK)
0