結果

問題 No.472 平均順位
ユーザー asumo0729asumo0729
提出日時 2020-12-16 13:27:12
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 794 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 894,416 KB
最終ジャッジ日時 2023-10-20 09:25:27
合計ジャッジ時間 7,584 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 40 ms
53,476 KB
testcase_02 AC 40 ms
53,472 KB
testcase_03 AC 40 ms
53,472 KB
testcase_04 AC 100 ms
76,136 KB
testcase_05 AC 41 ms
53,472 KB
testcase_06 AC 73 ms
70,884 KB
testcase_07 AC 93 ms
76,184 KB
testcase_08 AC 140 ms
80,980 KB
testcase_09 AC 304 ms
110,280 KB
testcase_10 AC 412 ms
129,580 KB
testcase_11 AC 814 ms
242,712 KB
testcase_12 AC 728 ms
219,656 KB
testcase_13 MLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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()
a=[]
for _ in range(n):
    now=tp()
    a.append((now))

inf=float('INF')
dp=[[inf for _ in range(3*n+1)]for _ in range(n)]
dp[0][0]=a[0][0]
dp[0][1]=a[0][1]
dp[0][2]=a[0][2]
dp[0][3]=1

for i in range(1,n):
    for j in range(3*n+1):
        dp[i][j]=min(dp[i][j],dp[i-1][j]+a[i][0])
        if 0<=j-1:
            dp[i][j]=min(dp[i][j],dp[i-1][j-1]+a[i][1])
        if 0<=j-2:
            dp[i][j]=min(dp[i][j],dp[i-1][j-2]+a[i][2])
        if 0<=j-3:
            dp[i][j]=min(dp[i][j],dp[i-1][j-3]+1)

print(dp[-1][p]/n)





0