結果

問題 No.472 平均順位
ユーザー titiatitia
提出日時 2024-01-08 01:40:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,138 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 81,828 KB
最終ジャッジ日時 2024-01-08 01:40:19
合計ジャッジ時間 6,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 62 ms
67,944 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 49 ms
61,712 KB
testcase_07 AC 77 ms
72,104 KB
testcase_08 AC 89 ms
76,072 KB
testcase_09 AC 122 ms
75,784 KB
testcase_10 AC 119 ms
76,072 KB
testcase_11 AC 208 ms
76,036 KB
testcase_12 AC 179 ms
75,916 KB
testcase_13 AC 534 ms
76,452 KB
testcase_14 AC 1,072 ms
80,240 KB
testcase_15 AC 472 ms
76,452 KB
testcase_16 AC 1,138 ms
81,508 KB
testcase_17 AC 779 ms
81,828 KB
testcase_18 AC 146 ms
75,912 KB
testcase_19 AC 276 ms
76,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

DP=[1<<30]*(P+1)
DP[0]=0

for i in range(N):
    a,b,c=map(int,input().split())
    NDP=[1<<30]*(P+1)

    for j in range(P+1):
        if DP[j]>=(1<<30):
            continue

        if j<=P:
            NDP[j]=min(NDP[j],DP[j]+a)

        if j+1<=P:
            NDP[j+1]=min(NDP[j+1],DP[j]+b)

        if j+2<=P:
            NDP[j+2]=min(NDP[j+2],DP[j]+c)

        if j+3<=P:
            NDP[j+3]=min(NDP[j+3],DP[j]+1)
    DP=NDP
        
print(DP[P]/N)
0