結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-03-14 22:00:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 971 bytes |
| 記録 | |
| コンパイル時間 | 1,584 ms |
| コンパイル使用メモリ | 161,304 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-14 22:01:00 |
| 合計ジャッジ時間 | 2,344 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 3 WA * 20 |
ソースコード
#include <bits/stdc++.h>
#define int long long
//#define USE_FREOPEN
//#define MUL_TEST
#define FILENAME "crystal"
using namespace std;
int dp[105][105];
int dx[55],dy[55],c[55];
void solve() {
int h,w,n,f;
cin >> h >> w >> n >> f;
for (int i = 1; i <= n; i++)
cin >> dx[i] >> dy[i] >> c[i];
for (int i = 0; i <= h; i++) {
for (int j = 0; j <= w; j++) {
dp[i][j] = (i + j) * f;
}
}
for (int i = 1; i <= n; i++) {
for (int x = 0; x <= h; x++) {
for (int y = 0; y < w; y++) {
int tx = x - dx[i],ty = y - dy[i];
if (tx < 0 || ty < 0 || tx >= h || ty >= w) continue;
dp[tx][ty] = min(dp[tx][ty],dp[x][y] + c[i]);
}
}
}
cout << dp[h][w] << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
#ifdef USE_FREOPEN
freopen(FILENAME ".in","r",stdin);
freopen(FILENAME ".out","w",stdout);
#endif
int _ = 1;
#ifdef MUL_TEST
cin >> _;
#endif
while (_--)
solve();
_^=_;
return 0^_^0;
}
vjudge1