結果

問題 No.2217 Suffix+
ユーザー もちふわゆるゆるもちふわゆるゆる
提出日時 2023-02-18 23:42:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 522 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 86,656 KB
実行使用メモリ 93,068 KB
最終ジャッジ日時 2023-09-27 11:59:03
合計ジャッジ時間 7,462 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,292 KB
testcase_01 AC 73 ms
71,044 KB
testcase_02 AC 75 ms
71,348 KB
testcase_03 AC 71 ms
71,344 KB
testcase_04 AC 70 ms
71,080 KB
testcase_05 AC 74 ms
71,440 KB
testcase_06 AC 73 ms
71,516 KB
testcase_07 AC 73 ms
71,284 KB
testcase_08 AC 74 ms
71,368 KB
testcase_09 AC 75 ms
71,332 KB
testcase_10 AC 73 ms
71,040 KB
testcase_11 AC 75 ms
71,284 KB
testcase_12 AC 74 ms
71,328 KB
testcase_13 AC 72 ms
71,344 KB
testcase_14 AC 96 ms
78,400 KB
testcase_15 AC 88 ms
78,424 KB
testcase_16 AC 98 ms
83,184 KB
testcase_17 AC 95 ms
80,340 KB
testcase_18 AC 88 ms
79,688 KB
testcase_19 AC 164 ms
87,588 KB
testcase_20 AC 152 ms
85,992 KB
testcase_21 AC 92 ms
76,424 KB
testcase_22 AC 157 ms
87,140 KB
testcase_23 AC 147 ms
83,600 KB
testcase_24 AC 115 ms
92,688 KB
testcase_25 AC 116 ms
92,612 KB
testcase_26 AC 118 ms
92,424 KB
testcase_27 AC 112 ms
92,712 KB
testcase_28 AC 112 ms
92,848 KB
testcase_29 AC 192 ms
92,748 KB
testcase_30 AC 192 ms
92,944 KB
testcase_31 AC 198 ms
92,752 KB
testcase_32 AC 190 ms
92,800 KB
testcase_33 AC 193 ms
92,812 KB
testcase_34 AC 114 ms
92,964 KB
testcase_35 AC 74 ms
71,252 KB
testcase_36 AC 227 ms
93,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
input = lambda: sys.stdin.readline()[:-1]
def MI(): return map(int, input().split())
inf = 10**18

n,k = MI()
a = list(MI())

def isok(mid):
    now = 0
    cnt = 0
    for left in range(n):
        mn = a[left] + now
        if mn<mid:
            tmp = -(-(mid-mn)//(left+1))
            cnt += tmp
            now += (left+1)*tmp
    
    if cnt<=k:
        return True
    else: return False

l,r = -1, 2*10**15
while abs(l-r)>1:
    mid = (l+r)//2
    if isok(mid): l = mid
    else: r = mid
print(l)
0