結果

問題 No.1861 Required Number
ユーザー BattleCatsBattleCats
提出日時 2022-03-04 21:39:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,174 bytes
コンパイル時間 1,519 ms
コンパイル使用メモリ 168,736 KB
実行使用メモリ 82,032 KB
最終ジャッジ日時 2023-09-26 03:16:40
合計ジャッジ時間 8,665 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 75 ms
81,660 KB
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 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 7 ms
6,356 KB
testcase_31 WA -
testcase_32 AC 8 ms
8,580 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
04_evil_1.txt MLE -
04_evil_2.txt MLE -
04_evil_3.txt MLE -
04_evil_4.txt MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define int long long
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rerep(i,j,a,b) rep(i,a,b-1) rep(j,i+1,b)
#define fore(i,a) for(auto &i : a)
#define all(x) (x).begin(),(x).end()
#define fix(i) fixed << setprecision(i)
#define next_per(s) next_permutation(all(s))

using namespace std;

template<class T>bool chmax(T& a, const T& b) { if(a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if(b < a) { a = b; return 1; } return 0; }

using pii = pair<int, int>;
using pque = priority_queue<int>;

void main_(); signed main() { main_(); return 0; }

/*------------------------------------------------------------------------------*/


const int INF = LLONG_MAX/2;
const int MOD = 1000000007;


/*------------------------------------------------------------------------------*/





void main_() {
  int N,K; cin >> N >> K;
  
  vector<int> a(N);
  rep(i,0,N) cin >> a[i];
  
  vector<vector<int>> dp(N+1, vector<int>(K+1));
  dp[0][0] = 1;
  rep(i,1,N+1) rep(j,0,K+1) {
    dp[i][j] = dp[i-1][j];
    if(a[i-1] <= j) dp[i][j] += dp[i-1][j-a[i-1]];
  }
  
  int Ans = dp[N][K];
  printf("%lld\n", Ans);
}
0