結果

問題 No.472 平均順位
ユーザー roiti46roiti46
提出日時 2016-10-11 22:45:10
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 77,792 KB
実行使用メモリ 666,792 KB
最終ジャッジ日時 2023-08-21 05:11:07
合計ジャッジ時間 12,149 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
76,560 KB
testcase_01 AC 76 ms
76,408 KB
testcase_02 AC 75 ms
76,624 KB
testcase_03 WA -
testcase_04 AC 92 ms
78,652 KB
testcase_05 AC 76 ms
76,604 KB
testcase_06 AC 87 ms
78,580 KB
testcase_07 AC 109 ms
79,568 KB
testcase_08 AC 146 ms
83,748 KB
testcase_09 AC 205 ms
96,376 KB
testcase_10 AC 182 ms
90,052 KB
testcase_11 AC 352 ms
130,228 KB
testcase_12 AC 317 ms
115,784 KB
testcase_13 AC 801 ms
211,728 KB
testcase_14 MLE -
testcase_15 AC 802 ms
211,876 KB
testcase_16 TLE -
testcase_17 MLE -
testcase_18 WA -
testcase_19 AC 461 ms
142,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

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

dp = [[10**9 + 7]*(P + 5) for i in xrange(N)]
for i in xrange(N):
    a, b, c = map(int, raw_input().split())
    if i == 0:
        dp[0][:4] = [a, b, c, 1]
        continue
    for j in xrange(min(3*(i + 1), P + 1)):
        dp[i][j] = min(dp[i][j], dp[i - 1][j] + a)
        if j > 0: dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + b)
        if j > 1: dp[i][j] = min(dp[i][j], dp[i - 1][j - 2] + c)
        if j > 2: dp[i][j] = min(dp[i][j], dp[i - 1][j - 3] + 1)

print "%.10f" % (1.0*dp[N - 1][P]/N)
0