結果
問題 | No.472 平均順位 |
ユーザー | terrafarm |
提出日時 | 2020-12-14 06:57:35 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,196 bytes |
コンパイル時間 | 876 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 639,720 KB |
最終ジャッジ日時 | 2023-10-20 04:44:31 |
合計ジャッジ時間 | 8,288 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 104 ms
84,092 KB |
testcase_01 | AC | 103 ms
79,648 KB |
testcase_02 | AC | 103 ms
79,652 KB |
testcase_03 | AC | 103 ms
79,756 KB |
testcase_04 | AC | 128 ms
80,968 KB |
testcase_05 | AC | 102 ms
79,648 KB |
testcase_06 | AC | 115 ms
80,320 KB |
testcase_07 | AC | 140 ms
81,112 KB |
testcase_08 | AC | 167 ms
85,012 KB |
testcase_09 | AC | 248 ms
97,480 KB |
testcase_10 | AC | 223 ms
92,280 KB |
testcase_11 | AC | 458 ms
131,692 KB |
testcase_12 | AC | 380 ms
117,084 KB |
testcase_13 | AC | 994 ms
212,952 KB |
testcase_14 | MLE | - |
testcase_15 | AC | 1,003 ms
213,044 KB |
testcase_16 | MLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
ソースコード
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()) a = [0] * n b = [0] * n c = [0] * n for i in range(n): a[i], b[i], c[i] = map(int, input().split()) dp = [[INF] * (p + 1) for _ in range(n + 1)] dp[0][0] = 0 for i in range(n): for j in range(p + 1): if j <= p: dp[i + 1][j] = min(dp[i][j] + a[i], dp[i + 1][j]) if j + 1 <= p: dp[i + 1][j + 1] = min(dp[i][j] + b[i], dp[i + 1][j + 1]) if j + 2 <= p: dp[i + 1][j + 2] = min(dp[i][j] + c[i], dp[i + 1][j + 2]) if j + 3 <= p: dp[i + 1][j + 3] = min(dp[i][j] + 1, dp[i + 1][j + 3]) # for i in range(n + 1): # dbg(dp[i]) ans = dp[n][p] / n print(ans) if __name__ == "__main__": main()