結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー titiatitia
提出日時 2023-06-27 04:49:00
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 474 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 79,172 KB
最終ジャッジ日時 2023-09-17 00:54:42
合計ジャッジ時間 5,253 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,248 KB
testcase_01 AC 68 ms
71,352 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 70 ms
71,368 KB
testcase_06 AC 76 ms
76,084 KB
testcase_07 AC 68 ms
71,404 KB
testcase_08 AC 93 ms
76,048 KB
testcase_09 AC 94 ms
75,964 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 WA -
testcase_23 AC 104 ms
76,216 KB
testcase_24 AC 104 ms
76,196 KB
testcase_25 AC 101 ms
76,264 KB
testcase_26 AC 103 ms
76,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Gx,Gy,N,F=map(int,input().split())

C=[list(map(int,input().split())) for i in range(N)]


DP=[[1<<60]*(Gx+1) for i in range(Gy+1)]
DP[0][0]=0

for i in range(Gx+1):
    for j in range(Gy+1):
        if i+1<Gx+1:
            DP[i+1][j]=min(DP[i+1][j],DP[i][j]+F)

        if j+1<Gy+1:
            DP[i][j+1]=min(DP[i][j+1],DP[i][j]+F)

        for x,y,c in C:
            if i+x<Gx+1 and j+y<Gy+1:
                DP[i+x][j+y]=min(DP[i+x][j+y],DP[i][j]+c)

print(DP[Gx][Gy])
0