結果

問題 No.472 平均順位
ユーザー 鯖缶鯖缶
提出日時 2023-12-04 15:59:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 62,860 KB
最終ジャッジ日時 2023-12-04 15:59:22
合計ジャッジ時間 9,794 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N,P = map(int,input().split())

data = np.array([list(map(int,input().split())) for _ in range(N)])

dp = np.zeros((N+1,P+1),int)
dp[1,:min(3,P+1)] = data[0,:min(3,P+1)]
dp[1:,0] = [data[:i,0].sum() for i in range(1,N+1)]

for i in range(N):
    for j in range(1,P+1):
        tmp = []
        if dp[i,j]!=0:tmp.append(dp[i,j]+data[i,0])
        if j-1>=0 and dp[i,j-1]!=0:tmp.append(dp[i,j-1]+data[i,1])
        if j-2>=0 and dp[i,j-2]!=0:tmp.append(dp[i,j-2]+data[i,2])
        if tmp:dp[i+1,j] = min(tmp)
print(min(1.,dp[:,P].max()/N))
0