結果

問題 No.472 平均順位
ユーザー hokekiyoohokekiyoo
提出日時 2020-02-20 10:08:50
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 837 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 91,776 KB
最終ジャッジ日時 2024-04-17 06:18:52
合計ジャッジ時間 10,255 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,712 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 37 ms
51,584 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 56 ms
63,872 KB
testcase_05 AC 37 ms
51,968 KB
testcase_06 AC 51 ms
62,592 KB
testcase_07 AC 71 ms
71,168 KB
testcase_08 AC 100 ms
76,536 KB
testcase_09 AC 159 ms
77,052 KB
testcase_10 AC 130 ms
76,664 KB
testcase_11 AC 290 ms
76,932 KB
testcase_12 AC 234 ms
76,660 KB
testcase_13 AC 620 ms
77,800 KB
testcase_14 AC 1,905 ms
87,156 KB
testcase_15 AC 634 ms
77,240 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 219 ms
77,020 KB
testcase_19 AC 334 ms
76,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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