結果

問題 No.2217 Suffix+
ユーザー chineristACchineristAC
提出日時 2023-02-17 23:16:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 94,332 KB
最終ジャッジ日時 2023-09-26 20:37:39
合計ジャッジ時間 8,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
74,452 KB
testcase_01 AC 114 ms
74,456 KB
testcase_02 AC 113 ms
74,208 KB
testcase_03 AC 108 ms
74,428 KB
testcase_04 AC 111 ms
74,456 KB
testcase_05 AC 112 ms
74,552 KB
testcase_06 AC 115 ms
74,312 KB
testcase_07 AC 112 ms
74,372 KB
testcase_08 AC 111 ms
74,340 KB
testcase_09 AC 112 ms
74,540 KB
testcase_10 AC 115 ms
74,640 KB
testcase_11 AC 115 ms
74,288 KB
testcase_12 AC 113 ms
74,092 KB
testcase_13 AC 114 ms
74,648 KB
testcase_14 AC 129 ms
81,440 KB
testcase_15 AC 130 ms
81,364 KB
testcase_16 AC 138 ms
86,420 KB
testcase_17 AC 135 ms
83,440 KB
testcase_18 AC 133 ms
82,532 KB
testcase_19 AC 207 ms
91,576 KB
testcase_20 AC 206 ms
90,156 KB
testcase_21 AC 135 ms
79,260 KB
testcase_22 AC 202 ms
91,456 KB
testcase_23 AC 186 ms
86,648 KB
testcase_24 AC 162 ms
94,232 KB
testcase_25 AC 164 ms
94,116 KB
testcase_26 AC 164 ms
94,256 KB
testcase_27 AC 164 ms
94,228 KB
testcase_28 AC 164 ms
94,332 KB
testcase_29 AC 250 ms
94,144 KB
testcase_30 AC 258 ms
94,008 KB
testcase_31 AC 255 ms
94,188 KB
testcase_32 AC 256 ms
94,292 KB
testcase_33 AC 255 ms
94,208 KB
testcase_34 AC 164 ms
93,984 KB
testcase_35 AC 113 ms
74,776 KB
testcase_36 AC 266 ms
94,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import gcd,log

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,K = mi()
A = li()

def cond(x):
    add = 0
    res = 0
    for i in range(N):
        if A[i]+add < x:
            need = (x-A[i]-add+i)//(i+1)
            res += need
            add += need * (i+1)
    
    return res <= K


ok = 0
ng = 10**17
while ng-ok>1:
    mid = (ok+ng)//2
    if cond(mid):
        ok = mid
    else:
        ng = mid

print(ok)


0