結果

問題 No.472 平均順位
ユーザー asumo0729asumo0729
提出日時 2020-12-16 13:18:18
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 771 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 81,856 KB
実行使用メモリ 848,580 KB
最終ジャッジ日時 2023-10-20 09:21:05
合計ジャッジ時間 5,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,500 KB
testcase_01 AC 39 ms
53,504 KB
testcase_02 AC 37 ms
53,500 KB
testcase_03 AC 36 ms
53,500 KB
testcase_04 AC 87 ms
76,200 KB
testcase_05 AC 42 ms
53,500 KB
testcase_06 AC 70 ms
72,988 KB
testcase_07 AC 92 ms
76,212 KB
testcase_08 AC 143 ms
82,416 KB
testcase_09 AC 354 ms
129,504 KB
testcase_10 AC 499 ms
150,496 KB
testcase_11 MLE -
testcase_12 MLE -
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()))
sp=lambda:stdin.readline().rstrip()
yp=lambda:print('Yes')
np=lambda:print('No')

n,p=lp()
a=[]
for _ in range(n):
    now=lp()
    now.append(1)
    a.append(now)

inf=float('INF')
dp=[[inf for _ in range(4*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]=a[0][3]

for i in range(1,n):
    for j in range(4*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]+a[i][3])

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





0