結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
mogurocker
|
| 提出日時 | 2017-10-16 17:07:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 1,363 ms |
| コンパイル使用メモリ | 158,316 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 20:54:24 |
| 合計ジャッジ時間 | 1,749 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;
int gx, gy, n, f, dp[105][105];
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(false);
cin >> gx >> gy >> n >> f;
FOR(i, gx+1) FOR(j, gy+1) dp[i][j] = (i+j)*f;
FOR(cnt, n) {
int x, y, c;
cin >> x >> y >> c;
dp[x][y] = min(dp[x][y], c);
for (int i = x; i <= gx; i++) {
for (int j = y; j <= gy; j++) {
dp[i][j] = min(dp[i-x][j-y]+dp[x][y], dp[i][j]);
}
}
}
cout << dp[gx][gy] << endl;
return 0;
}
mogurocker