結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-14 11:58:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 82,852 KB
最終ジャッジ日時 2023-08-21 12:08:20
合計ジャッジ時間 4,934 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,340 KB
testcase_01 AC 71 ms
71,288 KB
testcase_02 WA -
testcase_03 AC 74 ms
71,280 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 81 ms
75,692 KB
testcase_07 AC 71 ms
70,964 KB
testcase_08 WA -
testcase_09 AC 153 ms
82,228 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 112 ms
77,572 KB
testcase_13 AC 123 ms
78,060 KB
testcase_14 AC 121 ms
78,040 KB
testcase_15 AC 127 ms
78,088 KB
testcase_16 AC 124 ms
78,012 KB
testcase_17 AC 129 ms
78,672 KB
testcase_18 AC 129 ms
78,560 KB
testcase_19 AC 127 ms
77,980 KB
testcase_20 AC 126 ms
78,300 KB
testcase_21 AC 117 ms
77,364 KB
testcase_22 AC 167 ms
82,648 KB
testcase_23 WA -
testcase_24 AC 164 ms
82,852 KB
testcase_25 AC 158 ms
81,980 KB
testcase_26 AC 161 ms
82,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

gx,gy,n,f=map(int,input().split())
wa=[[0,0,0]]+[list(map(int,input().split())) for i in range(n)] + [[0,0,0]]
inf=10**8
dp=[[[inf]*(gy+1) for i in range(gx+1)] for i in range(n+2)]
dp[0][0][0] = 0

for w in range(n+1):
    for i in range(gx+1):
        for j in range(gy+1):
            if dp[w][i][j] == inf:
                continue
            if w+1 < n+2:
                dp[w+1][i][j] = min(dp[w+1][i][j],dp[w][i][j])
            
            x,y,c=wa[w][0],wa[w][1],wa[w][2]
            if i + 1 <= gx:
                dp[w][i+1][j] = min(dp[w][i+1][j],dp[w][i][j]+f)
            if j + 1 <= gy:
                dp[w][i][j+1] = min(dp[w][i][j+1],dp[w][i][j]+f)
            if i < i+x <=gx and j < j+y <=gy and w+1 < n+2:
                dp[w+1][i+x][j+y] = min(dp[w+1][i+x][j+y],dp[w][i][j] + c)

ans=10**10
# for i in range(n+2):
#     ans=min(ans,dp[i][gx][gy])
# print(ans)

print(dp[n+1][gx][gy])
            
            
0