結果

問題 No.472 平均順位
ユーザー roiti46roiti46
提出日時 2016-10-11 23:09:35
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 908 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 1,658 ms
コンパイル使用メモリ 77,416 KB
実行使用メモリ 80,876 KB
最終ジャッジ日時 2023-08-22 14:51:09
合計ジャッジ時間 7,957 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,424 KB
testcase_01 AC 75 ms
76,252 KB
testcase_02 AC 75 ms
76,152 KB
testcase_03 AC 75 ms
76,396 KB
testcase_04 AC 103 ms
78,752 KB
testcase_05 AC 76 ms
76,208 KB
testcase_06 AC 84 ms
78,728 KB
testcase_07 AC 101 ms
78,916 KB
testcase_08 AC 125 ms
80,508 KB
testcase_09 AC 148 ms
80,460 KB
testcase_10 AC 143 ms
80,492 KB
testcase_11 AC 201 ms
80,628 KB
testcase_12 AC 180 ms
80,216 KB
testcase_13 AC 336 ms
80,392 KB
testcase_14 AC 836 ms
80,876 KB
testcase_15 AC 362 ms
80,188 KB
testcase_16 AC 908 ms
80,596 KB
testcase_17 AC 848 ms
80,556 KB
testcase_18 AC 168 ms
80,732 KB
testcase_19 AC 225 ms
80,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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

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