結果

問題 No.1238 選抜クラス
ユーザー shell_mugshell_mug
提出日時 2020-09-25 21:50:06
言語 C++17(clang)
(14.0.0 + boost 1.83.0)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 2,064 bytes
コンパイル時間 5,828 ms
コンパイル使用メモリ 113,232 KB
実行使用メモリ 11,044 KB
最終ジャッジ日時 2023-09-10 15:15:07
合計ジャッジ時間 4,916 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,384 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 5 ms
4,384 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 101 ms
10,968 KB
testcase_18 AC 96 ms
10,688 KB
testcase_19 AC 98 ms
10,976 KB
testcase_20 AC 92 ms
10,692 KB
testcase_21 AC 87 ms
10,384 KB
testcase_22 AC 103 ms
10,984 KB
testcase_23 AC 103 ms
10,916 KB
testcase_24 AC 104 ms
10,904 KB
testcase_25 AC 103 ms
10,960 KB
testcase_26 AC 102 ms
10,956 KB
testcase_27 AC 104 ms
10,924 KB
testcase_28 AC 103 ms
11,044 KB
testcase_29 AC 100 ms
10,932 KB
testcase_30 AC 13 ms
5,676 KB
testcase_31 AC 33 ms
7,516 KB
testcase_32 AC 62 ms
9,444 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 75 ms
9,936 KB
testcase_35 AC 18 ms
6,204 KB
testcase_36 AC 6 ms
4,640 KB
testcase_37 AC 13 ms
5,672 KB
testcase_38 AC 93 ms
10,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
// #include <atcoder/all>
// using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, k; cin >> n >> k;
    ll MOD = (ll)1e9 + 7;
    vector<ll> a(n);
    rep (i, n) cin >> a[i];
    vector<vector<ll>> dp(n + 1, vector<ll>(10001));
    dp[0][0] = 1;
    rep (i, n) {
        reprev (x, i + 1) { reprev (s, 10001) {
            dp[x + 1][s + a[i]] = (dp[x + 1][s + a[i]] + dp[x][s]) % MOD;
        }}
    }
    ll ans = 0;
    rep (i, 1, n + 1) 
        rep (j, i * k, 10001)
            ans += dp[i][j];
    cout << ans % MOD << "\n";

    /***************************************************/
    /* Use "submit code (with ACL v1)" when using ACL! */
    /***************************************************/
    return 0;
}
0