結果
問題 | No.496 ワープクリスタル (給料日前編) |
ユーザー |
|
提出日時 | 2017-03-29 22:28:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 761 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 68,672 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 15:11:24 |
合計ジャッジ時間 | 1,301 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; #define INF 1930000000 const int MAX_N = 50; const int MAX_X = 100; const int MAX_Y = 100; int dp[MAX_X+1][MAX_Y+1]; int main(){ int gx,gy,N,F; cin >> gx >> gy >> N >> F; int x,y,c; for(int j = 0; j < gx+1; j++){ for(int k = 0; k < gy+1; k++){ dp[j][k] = F*(k+j);//初期化 //cout << dp[j][k] << " "; } // cout << endl; } for(int t = 0; t < N; t++){ cin >> x >> y >> c; for(int j = gx; j - x >= 0; j--){ for(int k = gy; k - y >= 0 ; k--){ dp[j][k] = min(dp[j][k],dp[j-x][k-y] + c); } } } cout << dp[gx][gy] << endl; return 0; }