結果
問題 |
No.496 ワープクリスタル (給料日前編)
|
ユーザー |
|
提出日時 | 2017-03-29 22:09:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 819 bytes |
コンパイル時間 | 582 ms |
コンパイル使用メモリ | 68,728 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 15:11:04 |
合計ジャッジ時間 | 1,290 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 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 i = 0; i < gy+1; i++){ for(int j = 0; j < gx+1; j++){ if(i - y >= 0 && j - x >= 0){ dp[i][j] = min(dp[i][j],dp[i-y][j-x]+c); } } } } cout << dp[gy][gx] <<endl; return 0; }