結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー mogurockermogurocker
提出日時 2017-10-16 17:10:27
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 1,293 ms
コンパイル使用メモリ 158,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 23:32:52
合計ジャッジ時間 2,371 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 52 ms
5,376 KB
testcase_09 AC 53 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 4 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 WA -
testcase_23 AC 16 ms
5,376 KB
testcase_24 AC 14 ms
5,376 KB
testcase_25 AC 12 ms
5,376 KB
testcase_26 AC 14 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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(roop, 100) {
			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;
}
0