結果

問題 No.472 平均順位
ユーザー soisusoisu
提出日時 2022-09-07 16:26:54
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 532 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 333,464 KB
最終ジャッジ日時 2023-08-14 20:44:26
合計ジャッジ時間 8,352 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,216 KB
testcase_01 AC 75 ms
71,444 KB
testcase_02 AC 72 ms
71,048 KB
testcase_03 AC 73 ms
71,172 KB
testcase_04 AC 92 ms
75,992 KB
testcase_05 AC 71 ms
71,256 KB
testcase_06 AC 87 ms
75,960 KB
testcase_07 AC 115 ms
77,468 KB
testcase_08 AC 152 ms
81,580 KB
testcase_09 AC 258 ms
105,688 KB
testcase_10 AC 224 ms
88,824 KB
testcase_11 AC 530 ms
169,580 KB
testcase_12 AC 420 ms
147,164 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
inf=float('inf')

N,P=map(int,input().split())
A,B,C=[0]*N,[0]*N,[0]*N

for i in range(N):
    A[i],B[i],C[i]=map(int,input().split())

dp=[[inf]*(P+1) for i in range(N+1)]
dp[0][0]=0

for i in range(N):
    for j in range(P+1):
        dp[i+1][j]=dp[i][j]+A[i]
        if 1<=j:
            dp[i+1][j]=min(dp[i+1][j],dp[i][j-1]+B[i])
        if 2<=j:
            dp[i+1][j]=min(dp[i+1][j],dp[i][j-2]+C[i])
        if 3<=j:
            dp[i+1][j]=min(dp[i+1][j],dp[i][j-3]+1)
print(dp[N][P]/N)
0