結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー kotatsugamekotatsugame
提出日時 2017-03-24 22:43:15
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 66,192 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 01:49:22
合計ジャッジ時間 1,766 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 23 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 24 ms
4,380 KB
testcase_09 AC 24 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 5 ms
4,380 KB
testcase_18 AC 7 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 8 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 24 ms
4,380 KB
testcase_23 AC 23 ms
4,376 KB
testcase_24 AC 23 ms
4,380 KB
testcase_25 AC 23 ms
4,380 KB
testcase_26 AC 23 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int dp[101][101];
main()
{
	int  gx,gy,n,f;cin>>gx>>gy>>n>>f;
	int x[50],y[50],c[50];
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>y[i]>>c[i];
	}
	for(int j=0;j<=gx;j++)
	{
		for(int l=0;l<=gy;l++)dp[j][l]=1<<17;
	}
	dp[0][0]=0;
	for(int i=0;i<=gx;i++)
	{
		for(int j=0;j<=gy;j++)
		{
			for(int k=0;k+i<=gx;k++)
			{
				for(int l=0;l+j<=gy;l++)
				{
					dp[i+k][j+l]=dp[i][j]+(k+l)*f;
				}
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=gx-x[i];j>=0;j--)
		{
			for(int k=gy-y[i];k>=0;k--)
			{
				dp[j+x[i]][k+y[i]]=
					min(dp[j+x[i]][k+y[i]],dp[j][k]+c[i]);
			}
		}
	}
	cout<<dp[gx][gy]<<endl;
}
0