結果

問題 No.2217 Suffix+
ユーザー roarisroaris
提出日時 2023-02-18 03:06:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 91,408 KB
最終ジャッジ日時 2023-09-26 23:30:14
合計ジャッジ時間 8,755 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,932 KB
testcase_01 AC 76 ms
71,184 KB
testcase_02 AC 73 ms
71,148 KB
testcase_03 AC 73 ms
71,316 KB
testcase_04 AC 75 ms
70,788 KB
testcase_05 AC 74 ms
71,320 KB
testcase_06 AC 75 ms
71,220 KB
testcase_07 AC 73 ms
71,008 KB
testcase_08 AC 72 ms
70,928 KB
testcase_09 AC 72 ms
71,292 KB
testcase_10 AC 74 ms
71,008 KB
testcase_11 AC 75 ms
71,000 KB
testcase_12 AC 76 ms
71,164 KB
testcase_13 AC 73 ms
71,128 KB
testcase_14 AC 115 ms
78,252 KB
testcase_15 AC 117 ms
78,156 KB
testcase_16 AC 154 ms
82,648 KB
testcase_17 AC 131 ms
80,080 KB
testcase_18 AC 123 ms
79,188 KB
testcase_19 AC 254 ms
86,468 KB
testcase_20 AC 225 ms
85,528 KB
testcase_21 AC 96 ms
76,072 KB
testcase_22 AC 239 ms
86,672 KB
testcase_23 AC 199 ms
83,176 KB
testcase_24 AC 213 ms
90,944 KB
testcase_25 AC 215 ms
91,000 KB
testcase_26 AC 221 ms
91,336 KB
testcase_27 AC 218 ms
91,248 KB
testcase_28 AC 213 ms
91,408 KB
testcase_29 AC 251 ms
91,344 KB
testcase_30 AC 252 ms
91,312 KB
testcase_31 AC 256 ms
91,324 KB
testcase_32 AC 249 ms
90,940 KB
testcase_33 AC 255 ms
91,104 KB
testcase_34 AC 215 ms
91,252 KB
testcase_35 AC 79 ms
71,172 KB
testcase_36 AC 270 ms
91,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def judge(x):
    add = 0
    need = 0
    
    for i in range(N):
        lack = max(0, x-A[i]-add)
        c = (lack+i)//(i+1)
        need += c
        add += c*(i+1)
    
    return need<=K

N, K = map(int, input().split())
A = list(map(int, input().split()))
ok = -1
ng = 10**18

while abs(ok-ng)>1:
    mid = (ok+ng)//2
    
    if judge(mid):
        ok = mid
    else:
        ng = mid

print(ok)
0