結果

問題 No.1478 Simple Sugoroku
ユーザー taiga000629taiga000629
提出日時 2021-04-16 23:35:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 87,412 KB
実行使用メモリ 106,776 KB
最終ジャッジ日時 2023-09-16 03:15:59
合計ジャッジ時間 9,701 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,828 KB
testcase_01 AC 69 ms
71,792 KB
testcase_02 AC 70 ms
71,592 KB
testcase_03 AC 69 ms
71,688 KB
testcase_04 AC 68 ms
71,508 KB
testcase_05 AC 71 ms
71,748 KB
testcase_06 AC 71 ms
71,812 KB
testcase_07 AC 72 ms
71,748 KB
testcase_08 AC 71 ms
71,668 KB
testcase_09 AC 68 ms
71,732 KB
testcase_10 AC 70 ms
71,604 KB
testcase_11 AC 71 ms
71,528 KB
testcase_12 AC 69 ms
71,876 KB
testcase_13 AC 271 ms
105,964 KB
testcase_14 AC 268 ms
105,252 KB
testcase_15 AC 267 ms
106,016 KB
testcase_16 AC 267 ms
106,108 KB
testcase_17 AC 263 ms
106,092 KB
testcase_18 AC 267 ms
106,776 KB
testcase_19 AC 272 ms
105,912 KB
testcase_20 AC 271 ms
105,820 KB
testcase_21 AC 266 ms
106,244 KB
testcase_22 AC 268 ms
106,128 KB
testcase_23 AC 269 ms
105,960 KB
testcase_24 AC 272 ms
105,848 KB
testcase_25 AC 270 ms
105,824 KB
testcase_26 AC 271 ms
105,868 KB
testcase_27 AC 276 ms
105,828 KB
testcase_28 AC 237 ms
103,712 KB
testcase_29 AC 203 ms
99,548 KB
testcase_30 AC 201 ms
99,824 KB
testcase_31 AC 200 ms
99,632 KB
testcase_32 AC 199 ms
99,844 KB
testcase_33 AC 199 ms
98,528 KB
testcase_34 AC 200 ms
98,936 KB
testcase_35 AC 201 ms
98,700 KB
testcase_36 AC 201 ms
98,564 KB
testcase_37 AC 231 ms
98,308 KB
testcase_38 AC 224 ms
98,300 KB
testcase_39 AC 230 ms
98,588 KB
testcase_40 AC 224 ms
98,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
b=[-1]+list(map(int,input().split()))
def f(s):
    dp=[10**10]*(m+1)
    dp[m]=n-b[m]
    for i in range(m-1,0,-1):
        dp[i]=min(dp[i+1]+b[i+1]-b[i],(s)/m+1)
    return sum(dp[i] for i in range(1,m+1))

mi=0
ma=m*n+1
while ma-mi>10**(-7):
    if mi!=0 and ma/mi-1<10**(-8):break
    mid=(ma+mi)/2
    if f(mid)-mid<0:ma=mid
    else:mi=mid

s=ma
dp=[10**10]*(m+1)
dp[m]=n-b[m]
for i in range(m-1,0,-1):
    dp[i]=min(dp[i+1]+b[i+1]-b[i],s/m+1)
print(dp[1]+b[1]-1)



0