結果

問題 No.472 平均順位
ユーザー roarisroaris
提出日時 2019-12-16 15:41:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 634,548 KB
最終ジャッジ日時 2023-09-15 17:38:33
合計ジャッジ時間 11,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,512 KB
testcase_01 AC 68 ms
71,284 KB
testcase_02 AC 69 ms
71,340 KB
testcase_03 AC 72 ms
71,380 KB
testcase_04 AC 96 ms
76,576 KB
testcase_05 AC 70 ms
71,536 KB
testcase_06 AC 81 ms
76,156 KB
testcase_07 AC 111 ms
77,260 KB
testcase_08 AC 139 ms
81,776 KB
testcase_09 AC 218 ms
93,680 KB
testcase_10 AC 195 ms
88,264 KB
testcase_11 AC 402 ms
128,212 KB
testcase_12 AC 329 ms
113,160 KB
testcase_13 AC 862 ms
209,644 KB
testcase_14 TLE -
testcase_15 AC 884 ms
209,788 KB
testcase_16 MLE -
testcase_17 TLE -
testcase_18 AC 304 ms
112,252 KB
testcase_19 AC 481 ms
141,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P = map(int, input().split())
abc = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[10**18]*(P+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
    ai, bi, ci = abc[i]
    
    for j in range(P+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j]+ai)
        
        if j+1<=P:
            dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j]+bi)
        
        if j+2<=P:
            dp[i+1][j+2] = min(dp[i+1][j+2], dp[i][j]+ci)
        
        if j+3<=P:
            dp[i+1][j+3] = min(dp[i+1][j+3], dp[i][j]+1)

print(dp[N][P]/N)
0