結果

問題 No.2317 Expression Menu
ユーザー CleyLCleyL
提出日時 2023-05-30 10:31:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 73,976 KB
実行使用メモリ 114,052 KB
最終ジャッジ日時 2023-08-28 00:29:00
合計ジャッジ時間 8,148 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 14 ms
10,736 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 188 ms
113,920 KB
testcase_24 AC 188 ms
114,048 KB
testcase_25 AC 188 ms
113,920 KB
testcase_26 AC 188 ms
113,804 KB
testcase_27 AC 188 ms
113,908 KB
testcase_28 AC 194 ms
113,808 KB
testcase_29 AC 188 ms
113,860 KB
testcase_30 AC 188 ms
113,812 KB
testcase_31 AC 188 ms
113,860 KB
testcase_32 AC 189 ms
113,928 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 WA -
testcase_39 AC 190 ms
113,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int dp[310][310][310];

struct f{
  int a,b,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]);
      }
    }
  }
  int 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