結果

問題 No.1478 Simple Sugoroku
ユーザー taiga000629taiga000629
提出日時 2021-04-16 23:33:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 109,468 KB
最終ジャッジ日時 2023-09-16 03:14:05
合計ジャッジ時間 10,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,796 KB
testcase_01 AC 67 ms
71,560 KB
testcase_02 AC 67 ms
71,792 KB
testcase_03 AC 68 ms
71,704 KB
testcase_04 AC 70 ms
71,728 KB
testcase_05 AC 68 ms
71,736 KB
testcase_06 AC 68 ms
71,824 KB
testcase_07 AC 70 ms
71,732 KB
testcase_08 AC 69 ms
71,652 KB
testcase_09 AC 69 ms
71,816 KB
testcase_10 AC 68 ms
71,760 KB
testcase_11 AC 69 ms
71,864 KB
testcase_12 AC 68 ms
71,840 KB
testcase_13 AC 284 ms
107,884 KB
testcase_14 AC 279 ms
107,860 KB
testcase_15 AC 284 ms
107,956 KB
testcase_16 AC 281 ms
107,980 KB
testcase_17 AC 280 ms
108,776 KB
testcase_18 AC 279 ms
108,484 KB
testcase_19 AC 284 ms
108,268 KB
testcase_20 AC 286 ms
107,828 KB
testcase_21 AC 282 ms
107,988 KB
testcase_22 AC 286 ms
107,884 KB
testcase_23 AC 281 ms
108,300 KB
testcase_24 AC 288 ms
108,204 KB
testcase_25 AC 282 ms
108,096 KB
testcase_26 AC 283 ms
108,100 KB
testcase_27 AC 286 ms
108,064 KB
testcase_28 AC 231 ms
103,404 KB
testcase_29 AC 268 ms
106,896 KB
testcase_30 AC 265 ms
105,636 KB
testcase_31 AC 267 ms
105,640 KB
testcase_32 AC 267 ms
105,596 KB
testcase_33 AC 270 ms
106,560 KB
testcase_34 AC 269 ms
106,332 KB
testcase_35 AC 269 ms
106,572 KB
testcase_36 AC 270 ms
106,464 KB
testcase_37 AC 314 ms
109,468 KB
testcase_38 AC 315 ms
109,436 KB
testcase_39 AC 315 ms
109,432 KB
testcase_40 AC 313 ms
109,268 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)+1)
    return sum(dp[i] for i in range(1,m+1))/m

mi=0
ma=n+1
while ma-mi>10**(-5):
    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+1)
print(dp[1]+b[1]-1)




0