結果

問題 No.472 平均順位
ユーザー mkawa2
提出日時 2020-05-06 09:12:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,015 ms / 2,000 ms
コード長 528 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-06-28 03:13:07
合計ジャッジ時間 6,106 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))

def main():
    inf=10**16
    n,p=MI()
    dp=[inf]*(p+1)
    dp[0]=0
    for _ in range(n):
        rank=LI()
        for i in range(p,-1,-1):
            dp[i]+=rank[0]
            if i-1>=0 and dp[i-1]+rank[1]<dp[i]:dp[i]=dp[i-1]+rank[1]
            if i-2>=0 and dp[i-2]+rank[2]<dp[i]:dp[i]=dp[i-2]+rank[2]
            if i-3>=0 and dp[i-3]+1<dp[i]:dp[i]=dp[i-3]+1

    print(dp[p]/n)

main()
0