結果

問題 No.472 平均順位
ユーザー asumo0729asumo0729
提出日時 2020-12-16 13:49:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,609 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 76,260 KB
最終ジャッジ日時 2023-10-20 09:32:50
合計ジャッジ時間 8,373 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,340 KB
testcase_01 AC 39 ms
53,344 KB
testcase_02 AC 39 ms
53,340 KB
testcase_03 AC 40 ms
53,340 KB
testcase_04 AC 54 ms
63,892 KB
testcase_05 AC 40 ms
53,340 KB
testcase_06 AC 51 ms
61,828 KB
testcase_07 AC 75 ms
72,792 KB
testcase_08 AC 101 ms
76,260 KB
testcase_09 AC 150 ms
76,064 KB
testcase_10 AC 125 ms
76,260 KB
testcase_11 AC 247 ms
76,080 KB
testcase_12 AC 218 ms
76,072 KB
testcase_13 AC 474 ms
76,076 KB
testcase_14 AC 1,489 ms
76,144 KB
testcase_15 AC 469 ms
76,080 KB
testcase_16 AC 1,570 ms
76,160 KB
testcase_17 AC 1,609 ms
75,992 KB
testcase_18 AC 188 ms
76,068 KB
testcase_19 AC 279 ms
76,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
stdin=sys.stdin

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
tp=lambda:tuple(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
yp=lambda:print('Yes')
np=lambda:print('No')

n,p=lp()
inf=float('inf')
dp=[inf for _ in range(p+1)]
dp[0]=0
for _ in range(n):
    now=lp()
    for i in  range(p,-1,-1):
        dp[i]+=now[0]
        if i-1>=0:
            dp[i]=min(dp[i-1]+now[1],dp[i])
        if i-2>=0:
            dp[i]=min(dp[i-2]+now[2],dp[i])
        if i-3>=0:
            dp[i]=min(dp[i-3]+1,dp[i])
print(dp[-1]/n)
0