結果

問題 No.1478 Simple Sugoroku
ユーザー taiga000629taiga000629
提出日時 2021-04-16 23:08:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 87,380 KB
実行使用メモリ 109,512 KB
最終ジャッジ日時 2023-09-16 02:30:51
合計ジャッジ時間 12,192 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,676 KB
testcase_01 AC 70 ms
71,420 KB
testcase_02 AC 70 ms
71,272 KB
testcase_03 AC 69 ms
71,632 KB
testcase_04 AC 71 ms
71,604 KB
testcase_05 AC 69 ms
71,648 KB
testcase_06 AC 70 ms
71,620 KB
testcase_07 AC 70 ms
71,588 KB
testcase_08 AC 69 ms
71,420 KB
testcase_09 AC 69 ms
71,372 KB
testcase_10 AC 69 ms
71,468 KB
testcase_11 AC 70 ms
71,508 KB
testcase_12 AC 70 ms
71,416 KB
testcase_13 AC 293 ms
107,768 KB
testcase_14 AC 283 ms
107,876 KB
testcase_15 AC 288 ms
107,952 KB
testcase_16 AC 290 ms
107,780 KB
testcase_17 AC 287 ms
108,564 KB
testcase_18 AC 284 ms
108,296 KB
testcase_19 AC 293 ms
108,460 KB
testcase_20 AC 293 ms
107,916 KB
testcase_21 AC 285 ms
107,660 KB
testcase_22 AC 298 ms
107,924 KB
testcase_23 AC 296 ms
108,024 KB
testcase_24 AC 297 ms
108,272 KB
testcase_25 AC 299 ms
108,356 KB
testcase_26 AC 296 ms
108,272 KB
testcase_27 AC 295 ms
108,040 KB
testcase_28 AC 239 ms
103,240 KB
testcase_29 AC 278 ms
106,860 KB
testcase_30 AC 278 ms
105,392 KB
testcase_31 AC 276 ms
105,676 KB
testcase_32 AC 276 ms
105,828 KB
testcase_33 AC 274 ms
106,400 KB
testcase_34 AC 276 ms
106,412 KB
testcase_35 AC 272 ms
106,472 KB
testcase_36 AC 276 ms
106,344 KB
testcase_37 AC 316 ms
109,348 KB
testcase_38 AC 319 ms
109,244 KB
testcase_39 AC 320 ms
109,512 KB
testcase_40 AC 322 ms
109,328 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