結果
問題 | No.496 ワープクリスタル (給料日前編) |
ユーザー |
![]() |
提出日時 | 2017-03-24 23:38:44 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 556 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 59,088 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 01:22:24 |
合計ジャッジ時間 | 1,277 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
#include <iostream>#include <sstream>#include <algorithm>using namespace std;int main(int argc, char *argv[]) {int Gx, Gy, N, F;cin >> Gx >> Gy >> N >> F;int cost[101][101];for (int i = 0; i <= Gy; ++i) {for (int j = 0; j <= Gx; ++j) {cost[i][j] = (i + j) * F;}}for (int i = 0; i < N; ++i) {int x, y, c;cin >> x >> y >> c;for (int j = Gy - y; j >= 0; --j) {for (int k = Gx - x; k >= 0; --k) {cost[j + y][k + x] = min(cost[j + y][k + x], cost[j][k] + c);}}}cout << cost[Gy][Gx] << endl;return 0;}