結果

問題 No.2217 Suffix+
ユーザー HydruHydru
提出日時 2023-02-17 22:35:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 99,140 KB
最終ジャッジ日時 2023-09-26 19:54:26
合計ジャッジ時間 5,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
70,896 KB
testcase_01 AC 71 ms
71,092 KB
testcase_02 AC 69 ms
71,048 KB
testcase_03 AC 70 ms
71,068 KB
testcase_04 AC 69 ms
71,088 KB
testcase_05 AC 71 ms
71,228 KB
testcase_06 AC 70 ms
70,996 KB
testcase_07 AC 70 ms
70,720 KB
testcase_08 AC 70 ms
71,056 KB
testcase_09 AC 69 ms
70,728 KB
testcase_10 AC 70 ms
70,732 KB
testcase_11 AC 71 ms
71,180 KB
testcase_12 AC 70 ms
71,192 KB
testcase_13 AC 72 ms
70,860 KB
testcase_14 AC 80 ms
78,224 KB
testcase_15 AC 80 ms
78,196 KB
testcase_16 AC 88 ms
83,100 KB
testcase_17 AC 81 ms
80,180 KB
testcase_18 AC 80 ms
79,280 KB
testcase_19 AC 102 ms
92,084 KB
testcase_20 AC 101 ms
89,924 KB
testcase_21 AC 80 ms
75,996 KB
testcase_22 AC 97 ms
91,776 KB
testcase_23 AC 93 ms
86,280 KB
testcase_24 AC 96 ms
92,156 KB
testcase_25 AC 97 ms
92,232 KB
testcase_26 AC 97 ms
92,240 KB
testcase_27 AC 96 ms
92,240 KB
testcase_28 AC 97 ms
92,512 KB
testcase_29 AC 112 ms
99,140 KB
testcase_30 AC 107 ms
99,100 KB
testcase_31 AC 108 ms
99,100 KB
testcase_32 AC 108 ms
99,132 KB
testcase_33 AC 108 ms
99,116 KB
testcase_34 AC 95 ms
92,552 KB
testcase_35 AC 71 ms
71,024 KB
testcase_36 AC 115 ms
99,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())

A=list(map(int,input().split()))
if k==0:
    print(min(A))
    exit()

min_num=2**61-1
min_ind=[]
for i in range(n):
    if min_num>A[i]:
        min_ind.append(i)
        min_num=A[i]

ans=A[min_ind[-1]]

for j in range(len(min_ind)-1,-1,-1):
    if j==0:
        ans+=k
        break
    n_ind=min_ind[j]
    p_ind=min_ind[j-1]
    
    y=(A[p_ind]-ans)//(n_ind+1)
    if y>=k:
        ans+=k*(n_ind+1)
        break
    k-=y
    ans+=y*(n_ind+1)
    
    if min(ans+n_ind+1,A[p_ind])>=ans+p_ind+1:
        k-=1
        ans=A[p_ind]

print(ans)
0