結果

問題 No.1238 選抜クラス
ユーザー YamaKasaYamaKasa
提出日時 2020-09-26 19:31:19
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 164,008 KB
実行使用メモリ 34,720 KB
最終ジャッジ日時 2023-09-12 01:02:33
合計ジャッジ時間 5,077 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 7 ms
6,212 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 6 ms
5,304 KB
testcase_08 AC 7 ms
6,172 KB
testcase_09 AC 9 ms
7,924 KB
testcase_10 AC 6 ms
5,672 KB
testcase_11 AC 8 ms
7,612 KB
testcase_12 AC 7 ms
6,488 KB
testcase_13 AC 7 ms
6,492 KB
testcase_14 AC 6 ms
6,220 KB
testcase_15 AC 9 ms
7,804 KB
testcase_16 AC 8 ms
7,488 KB
testcase_17 AC 48 ms
34,584 KB
testcase_18 AC 45 ms
33,716 KB
testcase_19 AC 46 ms
33,972 KB
testcase_20 AC 44 ms
33,096 KB
testcase_21 AC 43 ms
32,108 KB
testcase_22 AC 48 ms
34,612 KB
testcase_23 AC 48 ms
34,720 KB
testcase_24 AC 47 ms
34,608 KB
testcase_25 AC 48 ms
34,608 KB
testcase_26 AC 47 ms
34,624 KB
testcase_27 AC 48 ms
34,592 KB
testcase_28 AC 49 ms
34,668 KB
testcase_29 AC 47 ms
34,032 KB
testcase_30 AC 16 ms
12,740 KB
testcase_31 AC 27 ms
20,596 KB
testcase_32 AC 37 ms
27,696 KB
testcase_33 AC 5 ms
5,228 KB
testcase_34 AC 40 ms
30,032 KB
testcase_35 AC 19 ms
15,240 KB
testcase_36 AC 10 ms
9,032 KB
testcase_37 AC 16 ms
13,684 KB
testcase_38 AC 45 ms
33,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll mod = pow(10, 9) + 7;
const int l = 4 * 100 * 100 + 1;
const int m = 100 * 100;
ll dp[101][l + 1]{};

int main() {
    int N, K;
    cin >> N >> K;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i] -= K;
    }
    dp[0][m] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < l; j++) {
            dp[i + 1][j] += dp[i][j];
            dp[i + 1][j] %= mod;
            if (j + A[i] < 0 || j + A[i] >= l) continue;
            dp[i + 1][j + A[i]] += dp[i][j];
            dp[i + 1][j + A[i]] %= mod;
        }
    }
    ll s = 0;
    for (int i = m; i < l; i++) {
        s += dp[N][i];
        s %= mod;
    }
    cout << s - 1<< "\n";
    return 0;
}
0