結果

問題 No.1238 選抜クラス
ユーザー manjuuu_onsenmanjuuu_onsen
提出日時 2020-09-26 14:13:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,174 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 177,308 KB
実行使用メモリ 98,600 KB
最終ジャッジ日時 2023-09-11 10:57:29
合計ジャッジ時間 24,983 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
6,228 KB
testcase_01 AC 40 ms
7,352 KB
testcase_02 AC 109 ms
12,728 KB
testcase_03 AC 18 ms
5,308 KB
testcase_04 AC 17 ms
5,372 KB
testcase_05 AC 18 ms
5,356 KB
testcase_06 AC 18 ms
5,236 KB
testcase_07 AC 76 ms
9,948 KB
testcase_08 AC 108 ms
12,792 KB
testcase_09 AC 164 ms
17,536 KB
testcase_10 AC 86 ms
10,892 KB
testcase_11 AC 152 ms
16,780 KB
testcase_12 AC 122 ms
13,764 KB
testcase_13 AC 122 ms
13,684 KB
testcase_14 AC 108 ms
12,752 KB
testcase_15 AC 168 ms
17,432 KB
testcase_16 AC 156 ms
16,520 KB
testcase_17 AC 1,134 ms
98,504 KB
testcase_18 AC 1,094 ms
95,348 KB
testcase_19 AC 1,121 ms
96,712 KB
testcase_20 AC 1,095 ms
93,528 KB
testcase_21 AC 1,055 ms
90,788 KB
testcase_22 AC 1,087 ms
98,032 KB
testcase_23 AC 1,161 ms
98,572 KB
testcase_24 AC 1,174 ms
98,600 KB
testcase_25 AC 1,084 ms
98,104 KB
testcase_26 AC 1,155 ms
98,260 KB
testcase_27 AC 1,133 ms
98,264 KB
testcase_28 AC 1,136 ms
98,168 KB
testcase_29 AC 1,098 ms
96,324 KB
testcase_30 AC 348 ms
32,428 KB
testcase_31 AC 627 ms
55,916 KB
testcase_32 AC 873 ms
76,648 KB
testcase_33 AC 74 ms
9,900 KB
testcase_34 AC 962 ms
84,068 KB
testcase_35 AC 439 ms
40,020 KB
testcase_36 AC 213 ms
21,280 KB
testcase_37 AC 368 ms
34,332 KB
testcase_38 AC 1,082 ms
93,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>


using namespace std;
using ll = long long;
inline int ri() {int _; cin >> _; return _;}
const int AS = 10000;
constexpr ll mod = 1e9 + 7;

int main()
{
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for(int i = 0; i < n; i++)a[i] = ri() - k;
	vector<map<int,int>> dp(n + 1);
	dp[0][0] = 1;

	for(int i = 0; i < n; i++) {
		for(int j = -AS; j <= AS; j++) {
			dp[i + 1][j + a[i]] += dp[i][j];
			dp[i + 1][j + a[i]] %= mod;
			dp[i + 1][j] += dp[i][j];
			dp[i + 1][j] %= mod;
		}
	}

	ll sum = 0;
	for(int i = 0; i <= AS; i++) {
		sum += dp[n][i];
		sum %= mod;
	}

	cout << ((sum - 1) % mod + mod) % mod << endl;
}
0