結果

問題 No.472 平均順位
ユーザー vwxyzvwxyz
提出日時 2022-04-05 22:01:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 404 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 12,588 KB
最終ジャッジ日時 2023-08-18 03:53:10
合計ジャッジ時間 5,308 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,080 KB
testcase_01 AC 15 ms
7,764 KB
testcase_02 AC 15 ms
7,860 KB
testcase_03 AC 16 ms
7,932 KB
testcase_04 AC 24 ms
7,700 KB
testcase_05 AC 16 ms
7,828 KB
testcase_06 AC 19 ms
7,788 KB
testcase_07 AC 55 ms
7,784 KB
testcase_08 AC 740 ms
7,812 KB
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 sys
readline=sys.stdin.readline

N,P=map(int,readline().split())
inf=1<<30
dp=[inf]*(P+1)
dp[0]=0
for _ in range(N):
    a,b,c=map(int,readline().split())
    for i in range(P,-1,-1):
        dp[i]+=a
        if 0<=i-1:
            dp[i]=min(dp[i],dp[i-1]+b)
        if 0<=i-2:
            dp[i]=min(dp[i],dp[i-2]+c)
        if 0<=i-3:
            dp[i]=min(dp[i],dp[i-3]+1)
ans=dp[P]/N
print(ans)
0