結果

問題 No.472 平均順位
ユーザー roiti46roiti46
提出日時 2016-10-11 22:43:14
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 6,500 KB
実行使用メモリ 53,708 KB
最終ジャッジ日時 2023-08-21 05:10:50
合計ジャッジ時間 10,423 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,972 KB
testcase_01 AC 11 ms
5,996 KB
testcase_02 AC 11 ms
5,884 KB
testcase_03 WA -
testcase_04 AC 22 ms
6,136 KB
testcase_05 AC 12 ms
5,884 KB
testcase_06 AC 14 ms
6,040 KB
testcase_07 AC 44 ms
6,524 KB
testcase_08 AC 481 ms
15,376 KB
testcase_09 TLE -
testcase_10 AC 1,964 ms
41,380 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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