結果

問題 No.1238 選抜クラス
ユーザー face4face4
提出日時 2020-10-07 10:29:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 77,932 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 09:10:19
合計ジャッジ時間 2,841 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 21 ms
4,380 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 AC 34 ms
4,376 KB
testcase_20 AC 26 ms
4,380 KB
testcase_21 AC 29 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 19 ms
4,376 KB
testcase_27 AC 38 ms
4,384 KB
testcase_28 AC 21 ms
4,384 KB
testcase_29 AC 18 ms
4,376 KB
testcase_30 AC 3 ms
4,380 KB
testcase_31 AC 8 ms
4,380 KB
testcase_32 AC 21 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 14 ms
4,376 KB
testcase_35 AC 4 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 4 ms
4,380 KB
testcase_38 AC 19 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;

typedef pair<int,int> pii;

int main(){
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++)  cin >> a[i], a[i] -= k;
    const int mod = 1000000007;
    map<int,int> dp;
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        map<int,int> ndp = dp;
        for(pii p : dp){
            (ndp[p.first+a[i]] += p.second) %= mod;
        }
        dp = ndp;
    }
    int ans = 0;
    for(pii p : dp){
        if(p.first >= 0)    (ans += p.second) %= mod;
    }
    cout << (ans+mod-1)%mod << endl;
    return 0;
}
0