結果

問題 No.472 平均順位
ユーザー rlangevinrlangevin
提出日時 2023-10-20 12:24:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,893 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 85,020 KB
最終ジャッジ日時 2023-10-20 12:24:47
合計ジャッジ時間 8,878 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,512 KB
testcase_01 AC 38 ms
53,516 KB
testcase_02 AC 38 ms
53,512 KB
testcase_03 AC 38 ms
53,512 KB
testcase_04 AC 59 ms
62,432 KB
testcase_05 AC 38 ms
53,512 KB
testcase_06 AC 45 ms
59,560 KB
testcase_07 AC 50 ms
62,020 KB
testcase_08 AC 71 ms
68,612 KB
testcase_09 AC 115 ms
75,764 KB
testcase_10 AC 94 ms
74,368 KB
testcase_11 AC 262 ms
75,796 KB
testcase_12 AC 183 ms
75,788 KB
testcase_13 AC 511 ms
76,112 KB
testcase_14 AC 1,740 ms
81,844 KB
testcase_15 AC 511 ms
76,108 KB
testcase_16 AC 1,893 ms
83,788 KB
testcase_17 AC 1,670 ms
85,020 KB
testcase_18 AC 174 ms
75,820 KB
testcase_19 AC 275 ms
75,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, P = map(int, input().split())
inf = 10 ** 9
pre = [inf] * (P + 1)
pre[0] = 0
for _ in range(N):
    dp = [inf] * (P + 1)
    a, b, c = map(int, input().split())
    L = [a, b, c, 1]
    for j in range(4):
        v = L[j]
        for i in range(P + 1):
            if i - j < 0:
                continue
            dp[i] = min(dp[i], pre[i - j] + v)

    pre, dp = dp, pre

print(pre[-1]/N)
0