結果

問題 No.2217 Suffix+
ユーザー shakayamishakayami
提出日時 2023-02-17 22:23:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 126,492 KB
最終ジャッジ日時 2023-09-26 19:39:25
合計ジャッジ時間 6,809 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,352 KB
testcase_01 AC 74 ms
71,208 KB
testcase_02 AC 75 ms
71,180 KB
testcase_03 AC 74 ms
71,356 KB
testcase_04 AC 75 ms
70,972 KB
testcase_05 AC 75 ms
71,364 KB
testcase_06 AC 75 ms
71,284 KB
testcase_07 AC 74 ms
71,036 KB
testcase_08 AC 75 ms
71,340 KB
testcase_09 AC 74 ms
70,968 KB
testcase_10 AC 73 ms
71,416 KB
testcase_11 AC 73 ms
71,200 KB
testcase_12 AC 74 ms
71,036 KB
testcase_13 AC 73 ms
71,240 KB
testcase_14 AC 94 ms
88,000 KB
testcase_15 AC 98 ms
88,024 KB
testcase_16 AC 114 ms
102,416 KB
testcase_17 AC 105 ms
94,800 KB
testcase_18 AC 99 ms
90,648 KB
testcase_19 AC 154 ms
99,412 KB
testcase_20 AC 147 ms
98,616 KB
testcase_21 AC 88 ms
76,296 KB
testcase_22 AC 155 ms
99,604 KB
testcase_23 AC 140 ms
92,960 KB
testcase_24 AC 149 ms
125,732 KB
testcase_25 AC 151 ms
126,460 KB
testcase_26 AC 149 ms
126,404 KB
testcase_27 AC 150 ms
126,492 KB
testcase_28 AC 149 ms
126,256 KB
testcase_29 AC 202 ms
90,612 KB
testcase_30 AC 199 ms
90,320 KB
testcase_31 AC 203 ms
90,676 KB
testcase_32 AC 199 ms
90,580 KB
testcase_33 AC 199 ms
90,456 KB
testcase_34 AC 149 ms
126,468 KB
testcase_35 AC 73 ms
71,112 KB
testcase_36 AC 220 ms
91,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[int(i) for i in input().split()]

def solve(N,K,A,X):
    '''
    長さNの列Aに対して操作K回以下で最小値をX以上にできるかどうか
    '''
    B=[A[i] for i in range(N)]
    geta=0
    for i in range(N):
        B[i]+=geta
        if B[i]<X:
            tmp=(X-B[i]+i)//(i+1)
            K-=tmp
            if K<0:
                return False
            geta+=(i+1)*tmp
    if K>=0:
        return True
    else:
        return False

low=0
high=10**15
while(high-low>1):
    mid=(high+low)//2
    if solve(N,K,A,mid):
        low=mid
    else:
        high=mid
print(low)
0