結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー convexineqconvexineq
提出日時 2021-02-17 11:30:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 76,696 KB
最終ジャッジ日時 2023-10-11 22:50:18
合計ジャッジ時間 4,649 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,272 KB
testcase_01 AC 75 ms
71,088 KB
testcase_02 AC 76 ms
71,352 KB
testcase_03 AC 78 ms
71,540 KB
testcase_04 AC 75 ms
71,296 KB
testcase_05 AC 73 ms
71,352 KB
testcase_06 AC 79 ms
75,780 KB
testcase_07 AC 75 ms
71,424 KB
testcase_08 AC 97 ms
76,268 KB
testcase_09 AC 96 ms
76,260 KB
testcase_10 AC 81 ms
75,936 KB
testcase_11 AC 79 ms
75,728 KB
testcase_12 AC 82 ms
76,472 KB
testcase_13 AC 84 ms
76,124 KB
testcase_14 AC 84 ms
76,440 KB
testcase_15 AC 83 ms
76,568 KB
testcase_16 AC 83 ms
76,352 KB
testcase_17 AC 84 ms
76,252 KB
testcase_18 AC 84 ms
76,608 KB
testcase_19 AC 86 ms
76,516 KB
testcase_20 AC 87 ms
76,580 KB
testcase_21 AC 82 ms
76,388 KB
testcase_22 AC 89 ms
76,300 KB
testcase_23 AC 91 ms
76,584 KB
testcase_24 AC 87 ms
76,496 KB
testcase_25 AC 89 ms
76,696 KB
testcase_26 AC 89 ms
76,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ans = INF = 1<<30
gx,gy,n,f = map(int,input().split())
dp = [[INF]*(gy+1) for _ in range(gx+1)]
dp[0][0] = 0
for _ in range(n):
    x,y,c = map(int,input().split())
    for i in range(x,gx+1)[::-1]:
        for j in range(y,gy+1)[::-1]:
            dp[i][j] = min(dp[i][j],dp[i-x][j-y] + c)
for i in range(gx+1):
    for j in range(gy+1):
        ans = min(ans,dp[i][j] + f*(gx+gy-i-j))
print(ans)
0