結果

問題 No.472 平均順位
ユーザー hokekiyoohokekiyoo
提出日時 2020-02-20 10:05:24
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 813 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 852,480 KB
最終ジャッジ日時 2024-04-17 06:18:38
合計ジャッジ時間 6,283 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 41 ms
52,352 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 53 ms
63,760 KB
testcase_05 AC 37 ms
52,096 KB
testcase_06 AC 50 ms
61,952 KB
testcase_07 AC 69 ms
70,272 KB
testcase_08 AC 103 ms
80,200 KB
testcase_09 AC 179 ms
105,504 KB
testcase_10 AC 138 ms
91,348 KB
testcase_11 AC 364 ms
167,672 KB
testcase_12 AC 281 ms
137,348 KB
testcase_13 MLE -
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, P = map(int, input().split())
INF = 10**10
dp = [[INF] * (P+1) for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
    dp[i+1][:] = dp[i][:]
    scores = list(map(int, input().split())) + [1]    
    # 今まで解いた問題の合計 j
    for j in range(P+1):
        # if dp[i][j] == INF : continue
        # このコンテストで解いた問題数 k
        tmp = dp[i+1][j]
        score_j0 = dp[i][j]  + scores[0]
        tmp = score_j0 
        if j - 1 >= 0:
            score_j1 = dp[i][j-1] + scores[1]
            tmp = min(tmp, score_j1)
        if j - 2 >= 0:
            score_j2 = dp[i][j-2] + scores[2]
            tmp = min(tmp, score_j2)
        if j - 3 >= 0:
            score_j3 = dp[i][j-3] + scores[3]
            tmp = min(tmp, score_j3)
        dp[i+1][j] = tmp
print(dp[N][P]/N)
0