結果

問題 No.2217 Suffix+
ユーザー ntudantuda
提出日時 2023-02-22 21:24:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 93,112 KB
最終ジャッジ日時 2023-09-30 04:07:26
合計ジャッジ時間 7,669 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,348 KB
testcase_01 AC 70 ms
71,292 KB
testcase_02 AC 70 ms
71,292 KB
testcase_03 AC 71 ms
71,360 KB
testcase_04 AC 70 ms
71,296 KB
testcase_05 AC 71 ms
71,236 KB
testcase_06 AC 70 ms
71,232 KB
testcase_07 AC 71 ms
71,312 KB
testcase_08 AC 71 ms
71,292 KB
testcase_09 AC 70 ms
71,604 KB
testcase_10 AC 70 ms
71,536 KB
testcase_11 AC 70 ms
71,280 KB
testcase_12 AC 70 ms
71,264 KB
testcase_13 AC 71 ms
71,400 KB
testcase_14 AC 99 ms
78,528 KB
testcase_15 AC 83 ms
78,608 KB
testcase_16 AC 89 ms
83,476 KB
testcase_17 AC 85 ms
80,404 KB
testcase_18 AC 84 ms
79,728 KB
testcase_19 AC 138 ms
87,932 KB
testcase_20 AC 136 ms
86,360 KB
testcase_21 AC 87 ms
76,428 KB
testcase_22 AC 145 ms
87,796 KB
testcase_23 AC 130 ms
83,900 KB
testcase_24 AC 109 ms
92,764 KB
testcase_25 AC 106 ms
92,864 KB
testcase_26 AC 106 ms
92,492 KB
testcase_27 AC 106 ms
92,828 KB
testcase_28 AC 107 ms
92,848 KB
testcase_29 AC 198 ms
92,752 KB
testcase_30 AC 199 ms
93,112 KB
testcase_31 AC 201 ms
92,920 KB
testcase_32 AC 199 ms
92,888 KB
testcase_33 AC 197 ms
92,984 KB
testcase_34 AC 111 ms
92,920 KB
testcase_35 AC 70 ms
71,340 KB
testcase_36 AC 209 ms
93,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def check(x):
    a = 0
    b = 0
    for i in range(N):
        tmp = A[i] + b - x
        if tmp < 0:
            tmp2 = - (tmp // (i + 1))
            a += tmp2
            b += tmp2 * (i + 1)
        if a > K:
            return False
    return True

lb = 0
ub = A[0] + K + 1
while ub - lb > 1:
    mid = (ub + lb) // 2
    if check(mid):
        lb = mid
    else:
        ub = mid
print(lb)
0