結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー tsubametsubame
提出日時 2017-04-01 12:14:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 8,676 KB
最終ジャッジ日時 2023-09-22 01:58:18
合計ジャッジ時間 4,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,916 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 14 ms
7,816 KB
testcase_03 AC 14 ms
7,852 KB
testcase_04 AC 14 ms
7,788 KB
testcase_05 AC 14 ms
7,868 KB
testcase_06 AC 16 ms
8,488 KB
testcase_07 AC 15 ms
7,960 KB
testcase_08 AC 317 ms
8,564 KB
testcase_09 AC 299 ms
7,784 KB
testcase_10 AC 18 ms
7,812 KB
testcase_11 AC 19 ms
7,988 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 67 ms
7,816 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python

Gx, Gy, N, F = list(map(int, input().split()))
crystal = []
for i in range(N):
    crystal.append(tuple(map(int, input().split())))
    
crystal = tuple(crystal)
    
dp = [[(i + j) * F for i in range(Gx + 1)] for j in range(Gy + 1)]

for i in range(N):
    cx, cy, cc = crystal[i]
    for y in range(Gy, -1, -1):
        for x in range(Gx, -1, -1):
            dp[y][x] = min(dp[y][x], dp[y - cy][x - cx] + cc)

print (dp[Gy][Gx])
0