結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー lloyzlloyz
提出日時 2022-11-22 00:06:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 66,116 KB
最終ジャッジ日時 2023-10-23 19:34:09
合計ジャッジ時間 2,520 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,276 KB
testcase_01 AC 36 ms
53,276 KB
testcase_02 AC 37 ms
53,276 KB
testcase_03 AC 36 ms
53,276 KB
testcase_04 AC 36 ms
53,276 KB
testcase_05 AC 37 ms
53,276 KB
testcase_06 AC 40 ms
58,984 KB
testcase_07 AC 37 ms
53,276 KB
testcase_08 AC 62 ms
66,116 KB
testcase_09 AC 56 ms
63,964 KB
testcase_10 AC 41 ms
59,360 KB
testcase_11 AC 43 ms
59,604 KB
testcase_12 AC 46 ms
61,868 KB
testcase_13 AC 47 ms
61,948 KB
testcase_14 AC 45 ms
59,688 KB
testcase_15 AC 46 ms
61,952 KB
testcase_16 AC 46 ms
61,948 KB
testcase_17 AC 47 ms
61,948 KB
testcase_18 AC 49 ms
61,976 KB
testcase_19 AC 47 ms
61,948 KB
testcase_20 AC 48 ms
61,976 KB
testcase_21 AC 46 ms
61,636 KB
testcase_22 AC 51 ms
64,024 KB
testcase_23 AC 51 ms
64,024 KB
testcase_24 AC 49 ms
61,948 KB
testcase_25 AC 51 ms
64,024 KB
testcase_26 AC 51 ms
64,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

gx, gy, n, f = map(int, input().split())
P = [list(map(int, input().split())) for _ in range(n)]

DP = [[(i + j) * f for i in range(gx + 1)] for j in range(gy + 1)]
for k in range(n):
    x, y, c = P[k]
    for i in range(gy, y - 1, -1):
        for j in range(gx, x - 1, -1):
            DP[i][j] = min(DP[i][j], DP[i - y][j - x] + c)
print(DP[-1][-1])
0