結果

問題 No.2217 Suffix+
ユーザー KudeKude
提出日時 2023-02-17 21:28:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 93,076 KB
最終ジャッジ日時 2023-09-26 18:35:21
合計ジャッジ時間 6,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,220 KB
testcase_01 AC 75 ms
71,104 KB
testcase_02 AC 74 ms
71,228 KB
testcase_03 AC 80 ms
70,992 KB
testcase_04 AC 74 ms
71,228 KB
testcase_05 AC 74 ms
71,252 KB
testcase_06 AC 75 ms
71,280 KB
testcase_07 AC 77 ms
71,116 KB
testcase_08 AC 75 ms
71,220 KB
testcase_09 AC 72 ms
71,360 KB
testcase_10 AC 72 ms
71,336 KB
testcase_11 AC 73 ms
71,100 KB
testcase_12 AC 72 ms
71,312 KB
testcase_13 AC 73 ms
71,132 KB
testcase_14 AC 87 ms
78,680 KB
testcase_15 AC 92 ms
78,596 KB
testcase_16 AC 96 ms
83,444 KB
testcase_17 AC 95 ms
80,592 KB
testcase_18 AC 92 ms
79,704 KB
testcase_19 AC 143 ms
87,652 KB
testcase_20 AC 137 ms
86,096 KB
testcase_21 AC 92 ms
76,480 KB
testcase_22 AC 143 ms
87,564 KB
testcase_23 AC 133 ms
83,668 KB
testcase_24 AC 125 ms
92,892 KB
testcase_25 AC 122 ms
92,524 KB
testcase_26 AC 123 ms
92,756 KB
testcase_27 AC 127 ms
92,724 KB
testcase_28 AC 121 ms
92,804 KB
testcase_29 AC 195 ms
93,076 KB
testcase_30 AC 196 ms
92,852 KB
testcase_31 AC 191 ms
93,024 KB
testcase_32 AC 193 ms
92,808 KB
testcase_33 AC 192 ms
92,936 KB
testcase_34 AC 120 ms
92,916 KB
testcase_35 AC 74 ms
71,516 KB
testcase_36 AC 212 ms
92,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))
l = -1
r = a[0] + k + 1
while r - l > 1:
    c = (l + r) // 2
    cnt = 0
    add = 0
    for i, x in enumerate(a, 1):
        x += add
        if c > x:
            v = (c - x + i - 1) // i
            cnt += v
            add += v * i
    if cnt <= k:
        l = c
    else:
        r = c
print(l)
0