結果

問題 No.2217 Suffix+
ユーザー kohakoha11301kohakoha11301
提出日時 2023-02-26 17:32:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 93,452 KB
最終ジャッジ日時 2023-10-12 08:21:58
合計ジャッジ時間 9,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,428 KB
testcase_01 AC 79 ms
71,324 KB
testcase_02 AC 78 ms
71,424 KB
testcase_03 AC 79 ms
71,348 KB
testcase_04 AC 78 ms
71,456 KB
testcase_05 AC 73 ms
71,388 KB
testcase_06 AC 78 ms
71,580 KB
testcase_07 AC 74 ms
71,196 KB
testcase_08 AC 79 ms
71,320 KB
testcase_09 AC 79 ms
71,396 KB
testcase_10 AC 77 ms
71,644 KB
testcase_11 AC 78 ms
71,348 KB
testcase_12 AC 78 ms
71,416 KB
testcase_13 AC 79 ms
71,504 KB
testcase_14 AC 95 ms
78,904 KB
testcase_15 AC 92 ms
79,064 KB
testcase_16 AC 105 ms
83,408 KB
testcase_17 AC 102 ms
81,176 KB
testcase_18 AC 95 ms
80,300 KB
testcase_19 AC 226 ms
88,168 KB
testcase_20 AC 220 ms
86,236 KB
testcase_21 AC 117 ms
76,696 KB
testcase_22 AC 226 ms
87,784 KB
testcase_23 AC 214 ms
84,020 KB
testcase_24 AC 124 ms
93,060 KB
testcase_25 AC 120 ms
92,804 KB
testcase_26 AC 122 ms
93,352 KB
testcase_27 AC 122 ms
93,048 KB
testcase_28 AC 122 ms
93,208 KB
testcase_29 AC 343 ms
93,304 KB
testcase_30 AC 345 ms
93,208 KB
testcase_31 AC 343 ms
93,156 KB
testcase_32 AC 341 ms
93,452 KB
testcase_33 AC 343 ms
93,204 KB
testcase_34 AC 118 ms
93,152 KB
testcase_35 AC 71 ms
71,292 KB
testcase_36 AC 419 ms
93,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def judge(mid):
    cnt = 0
    nokori = k
    for i in range(n):
        if mid > a[i] + cnt:
            # print(cnt,(mid - a[i] - cnt))
            nokori -= math.ceil((mid - a[i] - cnt) / (i + 1))
            cnt += (i + 1) * math.ceil((mid - a[i] - cnt) / (i + 1))
    if nokori < 0:
        return False
    else:
        return True


n, k = map(int, input().split())
a = list(map(int, input().split()))
ok = 0
ng = 10 ** 18
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if judge(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0