結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー lloyzlloyz
提出日時 2022-11-22 00:03:37
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 356 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 81,820 KB
実行使用メモリ 64,228 KB
最終ジャッジ日時 2023-10-23 19:32:11
合計ジャッジ時間 2,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,464 KB
testcase_01 AC 37 ms
53,464 KB
testcase_02 AC 36 ms
53,464 KB
testcase_03 AC 38 ms
53,464 KB
testcase_04 WA -
testcase_05 AC 37 ms
53,464 KB
testcase_06 AC 43 ms
59,204 KB
testcase_07 AC 38 ms
53,464 KB
testcase_08 AC 60 ms
64,228 KB
testcase_09 AC 57 ms
64,144 KB
testcase_10 AC 42 ms
59,584 KB
testcase_11 AC 44 ms
59,820 KB
testcase_12 AC 47 ms
62,052 KB
testcase_13 AC 48 ms
62,128 KB
testcase_14 AC 45 ms
59,872 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 52 ms
64,212 KB
testcase_19 WA -
testcase_20 AC 49 ms
62,156 KB
testcase_21 AC 46 ms
61,860 KB
testcase_22 WA -
testcase_23 AC 53 ms
64,204 KB
testcase_24 AC 50 ms
62,128 KB
testcase_25 AC 53 ms
64,204 KB
testcase_26 AC 53 ms
64,204 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 + 1 - y):
        for j in range(gx + 1 - x):
            DP[i + y][j + x] = min(DP[i + y][j + x], DP[i][j] + c)
print(DP[-1][-1])
0