結果

問題 No.472 平均順位
ユーザー terrafarmterrafarm
提出日時 2020-12-14 07:29:21
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 971 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 107,072 KB
最終ジャッジ日時 2023-10-20 04:45:16
合計ジャッジ時間 8,434 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
79,924 KB
testcase_01 AC 98 ms
79,776 KB
testcase_02 AC 100 ms
79,772 KB
testcase_03 AC 100 ms
79,772 KB
testcase_04 AC 110 ms
80,412 KB
testcase_05 AC 100 ms
79,764 KB
testcase_06 AC 109 ms
80,780 KB
testcase_07 AC 109 ms
80,428 KB
testcase_08 AC 150 ms
80,976 KB
testcase_09 AC 291 ms
81,084 KB
testcase_10 AC 234 ms
81,000 KB
testcase_11 AC 680 ms
82,048 KB
testcase_12 AC 523 ms
81,452 KB
testcase_13 AC 1,716 ms
83,808 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import logging
import sys
from inspect import currentframe

# 一つ前の配列だけ持っていれば十分
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

logging.basicConfig(level=logging.DEBUG)


def dbg(*args):
    id2names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    logging.debug(
        ", ".join(id2names.get(id(arg), "???") + " = " + repr(arg) for arg in args)
    )


def main():

    INF = 10 ** 10
    n, p = map(int, input().split())
    dp = [[INF] * (p + 1) for _ in range(2)]
    dp[0][0] = 0
    for i in range(n):
        l = list(map(int, input().split()))
        l.append(1)
        for j in range(p + 1):
            for k in range(4):
                if j + k <= p:
                    dp[1][j + k] = min(dp[1][j + k], dp[0][j] + l[k])
        for j in range(p + 1):
            dp[0][j] = dp[1][j]
        dp[1] = [INF] * (p + 1)
    ans = dp[0][p] / n
    print(ans)


if __name__ == "__main__":
    main()
0