結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,560 KB
testcase_01 AC 67 ms
71,608 KB
testcase_02 AC 67 ms
71,548 KB
testcase_03 AC 65 ms
71,308 KB
testcase_04 WA -
testcase_05 AC 64 ms
71,224 KB
testcase_06 AC 71 ms
76,108 KB
testcase_07 AC 66 ms
71,600 KB
testcase_08 AC 89 ms
76,200 KB
testcase_09 AC 93 ms
76,364 KB
testcase_10 AC 77 ms
76,100 KB
testcase_11 AC 74 ms
75,992 KB
testcase_12 AC 85 ms
76,264 KB
testcase_13 AC 81 ms
76,124 KB
testcase_14 AC 84 ms
76,200 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 87 ms
76,432 KB
testcase_19 WA -
testcase_20 AC 84 ms
76,176 KB
testcase_21 AC 83 ms
76,180 KB
testcase_22 WA -
testcase_23 AC 97 ms
76,252 KB
testcase_24 AC 93 ms
76,324 KB
testcase_25 AC 93 ms
76,168 KB
testcase_26 AC 91 ms
76,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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


DP=[[1<<60]*(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 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