結果

問題 No.2217 Suffix+
ユーザー tonpe_yoshiharutonpe_yoshiharu
提出日時 2023-02-19 01:06:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 93,380 KB
最終ジャッジ日時 2023-09-27 12:45:22
合計ジャッジ時間 7,456 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,272 KB
testcase_01 AC 66 ms
71,272 KB
testcase_02 AC 65 ms
71,276 KB
testcase_03 AC 65 ms
71,392 KB
testcase_04 AC 66 ms
71,560 KB
testcase_05 AC 66 ms
71,476 KB
testcase_06 AC 67 ms
71,236 KB
testcase_07 AC 67 ms
71,388 KB
testcase_08 AC 66 ms
71,408 KB
testcase_09 AC 70 ms
71,396 KB
testcase_10 AC 71 ms
71,280 KB
testcase_11 AC 66 ms
71,416 KB
testcase_12 AC 65 ms
71,248 KB
testcase_13 AC 65 ms
71,624 KB
testcase_14 AC 74 ms
78,556 KB
testcase_15 AC 79 ms
78,852 KB
testcase_16 AC 86 ms
83,496 KB
testcase_17 AC 82 ms
80,960 KB
testcase_18 AC 79 ms
80,080 KB
testcase_19 AC 154 ms
87,720 KB
testcase_20 AC 152 ms
86,108 KB
testcase_21 AC 88 ms
76,536 KB
testcase_22 AC 150 ms
87,560 KB
testcase_23 AC 141 ms
83,576 KB
testcase_24 AC 104 ms
92,728 KB
testcase_25 AC 104 ms
92,764 KB
testcase_26 AC 104 ms
92,952 KB
testcase_27 AC 105 ms
92,744 KB
testcase_28 AC 102 ms
92,948 KB
testcase_29 AC 190 ms
93,244 KB
testcase_30 AC 204 ms
93,104 KB
testcase_31 AC 187 ms
93,292 KB
testcase_32 AC 189 ms
93,304 KB
testcase_33 AC 195 ms
93,240 KB
testcase_34 AC 100 ms
93,088 KB
testcase_35 AC 69 ms
71,252 KB
testcase_36 AC 229 ms
93,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def is_ok(mi):
    s = 0
    l = 0
    for i in range(n):
        if a[i] + s < mi:
            m = math.ceil((mi - a[i] - s) / (i + 1))
            s += (i + 1) * m
            l += m
    return l <= k


n, k = map(int, input().split())
a = list(map(int, input().split()))

ok, ng = 0, 10 ** 15 + 1
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid

print(ok)
0