結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー fiordfiord
提出日時 2017-03-25 13:32:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 71,036 KB
実行使用メモリ 6,008 KB
最終ジャッジ日時 2023-09-20 10:35:32
合計ジャッジ時間 1,663 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 8 ms
5,892 KB
testcase_09 AC 7 ms
5,900 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 3 ms
4,508 KB
testcase_15 AC 3 ms
4,384 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,632 KB
testcase_18 AC 4 ms
5,284 KB
testcase_19 AC 3 ms
4,704 KB
testcase_20 AC 3 ms
4,928 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 7 ms
5,940 KB
testcase_23 AC 7 ms
5,880 KB
testcase_24 AC 7 ms
6,008 KB
testcase_25 AC 7 ms
5,860 KB
testcase_26 AC 6 ms
5,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int dp[101][101][64];
int main(){
	int gx,gy,n,f;	cin>>gx>>gy>>n>>f;
	for(int i=0;i<=gy;i++){
		for(int j=0;j<=gx;j++){
			for(int k=0;k<=n;k++)	dp[i][j][k]=1e9;
		}
	}
	dp[0][0][0]=0;
	for(int k=0;k<n;k++){
		int x,y,c;	cin>>x>>y>>c;
		for(int i=0;i<=gy;i++)	for(int j=0;j<=gx;j++){
			dp[i][j][k+1]=min(dp[i][j][k+1],dp[i][j][k]);
			if(i<gy)	dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]+f);
			if(j<gx)	dp[i][j+1][k]=min(dp[i][j+1][k],dp[i][j][k]+f);
			int nx=x+j,ny=y+i;
			if(nx<=gx&&ny<=gy)	dp[ny][nx][k+1]=min(dp[ny][nx][k+1],dp[i][j][k]+c);
		}
	}
	cout<<dp[gy][gx][n]<<endl;
	return 0;
}
0