結果

問題 No.1238 選抜クラス
ユーザー simansiman
提出日時 2020-12-29 08:35:53
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 906 bytes
コンパイル時間 1,202 ms
コンパイル使用メモリ 139,744 KB
実行使用メモリ 11,288 KB
最終ジャッジ日時 2024-04-15 08:03:49
合計ジャッジ時間 5,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 4 ms
11,232 KB
testcase_06 AC 4 ms
11,172 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 4 ms
6,944 KB
testcase_09 RE -
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 RE -
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 4 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 50 ms
11,104 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 46 ms
11,172 KB
testcase_24 RE -
testcase_25 AC 48 ms
11,288 KB
testcase_26 RE -
testcase_27 AC 50 ms
11,252 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 5 ms
6,944 KB
testcase_31 RE -
testcase_32 AC 26 ms
10,560 KB
testcase_33 AC 4 ms
7,128 KB
testcase_34 RE -
testcase_35 AC 7 ms
6,940 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);

  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  ll dp[K + 1][K * 100 + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;

  for (int i = 0; i < N; ++i) {
    int a = A[i];

    for (int k = i; k >= 0; --k) {
      for (int j = 0; j <= 100 * i; ++j) {
        if (dp[k][j] == 0) continue;

        dp[k + 1][j + a] += dp[k][j];
        dp[k + 1][j + a] %= MOD;
      }
    }
  }

  ll ans = 0;

  for (int i = 1; i <= N; ++i) {
    for (int j = i * K; j <= 100 * N; ++j) {
      ans += dp[i][j];
      ans %= MOD;
    }
  }

  cout << ans << endl;

  return 0;
}
0