結果

問題 No.1238 選抜クラス
ユーザー y61mpnly61mpnl
提出日時 2020-09-26 00:15:27
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 197,888 KB
実行使用メモリ 19,520 KB
最終ジャッジ日時 2023-09-10 17:18:07
合計ジャッジ時間 3,721 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 3 ms
5,024 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 2 ms
4,384 KB
testcase_07 AC 3 ms
4,684 KB
testcase_08 AC 4 ms
5,148 KB
testcase_09 AC 4 ms
5,812 KB
testcase_10 AC 4 ms
4,756 KB
testcase_11 AC 4 ms
5,704 KB
testcase_12 AC 4 ms
5,256 KB
testcase_13 AC 4 ms
5,184 KB
testcase_14 AC 3 ms
5,136 KB
testcase_15 AC 4 ms
5,940 KB
testcase_16 AC 3 ms
5,656 KB
testcase_17 AC 14 ms
19,444 KB
testcase_18 AC 14 ms
18,984 KB
testcase_19 AC 14 ms
19,184 KB
testcase_20 AC 14 ms
18,576 KB
testcase_21 AC 13 ms
18,192 KB
testcase_22 AC 15 ms
19,380 KB
testcase_23 AC 14 ms
19,360 KB
testcase_24 AC 15 ms
19,464 KB
testcase_25 AC 14 ms
19,432 KB
testcase_26 AC 14 ms
19,520 KB
testcase_27 AC 14 ms
19,436 KB
testcase_28 AC 14 ms
19,460 KB
testcase_29 AC 14 ms
19,044 KB
testcase_30 AC 7 ms
8,360 KB
testcase_31 AC 10 ms
12,340 KB
testcase_32 AC 12 ms
15,884 KB
testcase_33 AC 3 ms
4,528 KB
testcase_34 AC 13 ms
17,344 KB
testcase_35 AC 8 ms
9,668 KB
testcase_36 AC 4 ms
6,568 KB
testcase_37 AC 7 ms
8,720 KB
testcase_38 AC 13 ms
18,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
using ll = int_fast64_t;
const int MOD = 1e9+7;

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    int a[n];
    REP(i, 0, n){
        scanf("%d", &a[i]);
        a[i] -= k;
    }

    ll dp[1+n][20200] = {};
    dp[0][10100] = 1;
    REP(i, 1, 1+n){
        REP(j, 0, 20200){
            dp[i][j] += dp[i-1][j];
            dp[i][j] %= MOD;
            if(j<a[i-1] or 20200<=j-a[i-1]) continue;
            dp[i][j] += dp[i-1][j-a[i-1]];
            dp[i][j] %= MOD;
        }
    }

    ll ans = 0;
    REP(i, 10100, 20200){
        ans += dp[n][i];
        ans %= MOD;
    }

    printf("%ld\n", (ans-1+MOD)%MOD);
    return 0;
}
0