結果

問題 No.2317 Expression Menu
ユーザー 沙耶花沙耶花
提出日時 2023-05-26 21:26:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 713 bytes
コンパイル時間 4,296 ms
コンパイル使用メモリ 261,456 KB
実行使用メモリ 4,832 KB
最終ジャッジ日時 2023-08-26 10:06:32
合計ジャッジ時間 10,111 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 10 ms
4,696 KB
testcase_03 AC 126 ms
4,832 KB
testcase_04 AC 126 ms
4,468 KB
testcase_05 AC 125 ms
4,508 KB
testcase_06 AC 127 ms
4,472 KB
testcase_07 AC 126 ms
4,564 KB
testcase_08 AC 126 ms
4,464 KB
testcase_09 AC 126 ms
4,588 KB
testcase_10 AC 125 ms
4,564 KB
testcase_11 AC 126 ms
4,532 KB
testcase_12 AC 125 ms
4,464 KB
testcase_13 AC 125 ms
4,536 KB
testcase_14 AC 125 ms
4,568 KB
testcase_15 AC 126 ms
4,688 KB
testcase_16 AC 126 ms
4,532 KB
testcase_17 AC 127 ms
4,588 KB
testcase_18 AC 125 ms
4,592 KB
testcase_19 AC 126 ms
4,512 KB
testcase_20 AC 125 ms
4,588 KB
testcase_21 AC 127 ms
4,468 KB
testcase_22 AC 126 ms
4,628 KB
testcase_23 AC 133 ms
4,524 KB
testcase_24 AC 134 ms
4,480 KB
testcase_25 AC 131 ms
4,660 KB
testcase_26 AC 133 ms
4,512 KB
testcase_27 AC 129 ms
4,652 KB
testcase_28 AC 135 ms
4,668 KB
testcase_29 AC 130 ms
4,612 KB
testcase_30 AC 131 ms
4,832 KB
testcase_31 AC 132 ms
4,616 KB
testcase_32 AC 132 ms
4,696 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 3 ms
4,408 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 133 ms
4,668 KB
testcase_39 AC 133 ms
4,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001



int main(){
	
	int n,x,y;
	cin>>n>>x>>y;
	vector dp(x+1,vector<long long>(y+1,0));
	rep(i,n){
		long long a,b,c;
		cin>>a>>b>>c;
		vector ndp(x+1,vector<long long>(y+1,0));
		rep(j,x+1){
			rep(k,y+1){
				ndp[j][k] = max(ndp[j][k],dp[j][k]);
				if(j+a<=x&&k+b<=y){
					ndp[j+a][k+b] = max(ndp[j+a][k+b],dp[j][k] + c);
				}
			}
		}
		swap(dp,ndp);
	}
	
	long long ans = 0;
	rep(i,x+1){
		rep(j,y+1)ans = max(ans,dp[i][j]);
	}
	cout<<ans<<endl;
	return 0;
}
0