結果

問題 No.2317 Expression Menu
ユーザー CleyLCleyL
提出日時 2023-05-30 10:32:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 692 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 223,400 KB
最終ジャッジ日時 2023-08-28 00:29:20
合計ジャッジ時間 11,485 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 21 ms
18,104 KB
testcase_03 AC 296 ms
223,316 KB
testcase_04 AC 275 ms
223,276 KB
testcase_05 AC 278 ms
223,284 KB
testcase_06 AC 276 ms
223,208 KB
testcase_07 AC 275 ms
223,260 KB
testcase_08 AC 275 ms
223,248 KB
testcase_09 AC 281 ms
223,212 KB
testcase_10 AC 274 ms
223,204 KB
testcase_11 AC 277 ms
223,268 KB
testcase_12 AC 279 ms
223,192 KB
testcase_13 AC 273 ms
223,272 KB
testcase_14 AC 277 ms
223,204 KB
testcase_15 AC 275 ms
223,276 KB
testcase_16 AC 274 ms
223,208 KB
testcase_17 AC 276 ms
223,316 KB
testcase_18 AC 275 ms
223,216 KB
testcase_19 AC 278 ms
223,188 KB
testcase_20 AC 275 ms
223,192 KB
testcase_21 AC 275 ms
223,272 KB
testcase_22 AC 277 ms
223,264 KB
testcase_23 AC 298 ms
223,216 KB
testcase_24 AC 300 ms
223,316 KB
testcase_25 AC 300 ms
223,400 KB
testcase_26 AC 299 ms
223,196 KB
testcase_27 AC 300 ms
223,204 KB
testcase_28 AC 301 ms
223,276 KB
testcase_29 AC 298 ms
223,360 KB
testcase_30 AC 298 ms
223,204 KB
testcase_31 AC 299 ms
223,260 KB
testcase_32 AC 300 ms
223,216 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 3 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 3 ms
4,376 KB
testcase_38 AC 305 ms
223,200 KB
testcase_39 AC 304 ms
223,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

long long dp[310][310][310];

struct f{
  int a,b;
  long long c;
};

int main(){
  int n,x,y;cin>>n>>x>>y;
  vector<f> A(n);
  for(int i = 0; n > i; i++)cin>>A[i].a>>A[i].b>>A[i].c;
  for(int i = 0; n > i; i++){
    for(int j = 0; x >= j; j++){
      for(int k = 0; y >= k; k++){
        if(j+A[i].a <= x && k+A[i].b <= y)dp[i+1][j+A[i].a][k+A[i].b] = max(dp[i+1][j+A[i].a][k+A[i].b], dp[i][j][k]+A[i].c);
        dp[i+1][j][k] = max(dp[i+1][j][k], dp[i][j][k]);
      }
    }
  }
  long long mx = 0;
  for(int i = 0; x >= i; i++){
    for(int j = 0; y >= j; j++){
      mx = max(mx,dp[n][i][j]);
    }
  }
  cout << mx << endl;
}
0