結果

問題 No.472 平均順位
ユーザー fiordfiord
提出日時 2017-08-14 17:26:41
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 531 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 637,684 KB
最終ジャッジ日時 2024-04-21 11:24:25
合計ジャッジ時間 12,340 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,584 KB
testcase_01 AC 39 ms
51,840 KB
testcase_02 AC 40 ms
51,840 KB
testcase_03 AC 38 ms
51,584 KB
testcase_04 AC 75 ms
70,784 KB
testcase_05 AC 38 ms
52,096 KB
testcase_06 AC 55 ms
63,232 KB
testcase_07 AC 90 ms
75,904 KB
testcase_08 AC 125 ms
80,136 KB
testcase_09 AC 183 ms
92,368 KB
testcase_10 AC 164 ms
86,784 KB
testcase_11 AC 351 ms
126,932 KB
testcase_12 AC 288 ms
112,512 KB
testcase_13 AC 769 ms
207,580 KB
testcase_14 TLE -
testcase_15 AC 808 ms
207,464 KB
testcase_16 MLE -
testcase_17 TLE -
testcase_18 AC 261 ms
111,488 KB
testcase_19 AC 422 ms
139,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(int, input().split())
dp = [[10**9] * (p + 1) for i in range(n + 1)]
dp[0][0] = 0
for i in range(n):
    a, b, c = map(int, input().split())
    for j in range(p + 1):
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + a)
        if j < p:
            dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + b)
        if j + 1 < p:
            dp[i + 1][j + 2] = min(dp[i + 1][j + 2], dp[i][j] + c)
        if j + 2 < p:
            dp[i + 1][j + 3] = min(dp[i + 1][j + 3], dp[i][j] + 1)
print(float(dp[n][p]) / float(n))
0