結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー kohei2019kohei2019
提出日時 2022-02-01 20:49:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 76,384 KB
最終ジャッジ日時 2023-09-02 02:35:08
合計ジャッジ時間 4,705 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,236 KB
testcase_01 AC 66 ms
71,472 KB
testcase_02 AC 67 ms
71,192 KB
testcase_03 AC 67 ms
71,076 KB
testcase_04 WA -
testcase_05 AC 68 ms
71,296 KB
testcase_06 AC 80 ms
76,168 KB
testcase_07 AC 64 ms
71,240 KB
testcase_08 AC 93 ms
76,272 KB
testcase_09 AC 88 ms
76,268 KB
testcase_10 AC 74 ms
76,100 KB
testcase_11 AC 74 ms
76,044 KB
testcase_12 AC 83 ms
76,304 KB
testcase_13 AC 82 ms
76,276 KB
testcase_14 AC 83 ms
76,268 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 82 ms
76,268 KB
testcase_19 WA -
testcase_20 AC 83 ms
76,108 KB
testcase_21 AC 78 ms
76,116 KB
testcase_22 WA -
testcase_23 AC 93 ms
76,244 KB
testcase_24 AC 86 ms
76,160 KB
testcase_25 AC 91 ms
76,244 KB
testcase_26 AC 87 ms
76,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

gx,gy,N,F = map(int,input().split())
lsxyz = [list(map(int,input().split())) for i in range(N)]
inf = float('INF')
dp = [[inf]*(gy+1) for i in range(gx+1)]
dp[0][0] = 0

for i in range(gx+1):
    for j in range(gy+1):
        if 0 <= i-1:
            dp[i][j] = min(dp[i][j],dp[i-1][j]+F)
        if 0 <= j-1:
            dp[i][j] = min(dp[i][j],dp[i][j-1]+F)
        for x,y,z in lsxyz:
            if 0 <= i-x and 0 <= j-y:
                dp[i][j] = min(dp[i][j],dp[i-x][j-y]+z)
print(dp[-1][-1])
0