結果

問題 No.1238 選抜クラス
ユーザー kk
提出日時 2020-10-27 19:50:19
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 867 bytes
コンパイル時間 2,607 ms
コンパイル使用メモリ 200,868 KB
実行使用メモリ 11,364 KB
最終ジャッジ日時 2023-09-29 03:23:09
合計ジャッジ時間 4,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,400 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,416 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 7 ms
10,916 KB
testcase_20 WA -
testcase_21 AC 7 ms
10,640 KB
testcase_22 WA -
testcase_23 AC 8 ms
11,268 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 7 ms
11,180 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 5 ms
7,372 KB
testcase_31 WA -
testcase_32 AC 5 ms
9,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 WA -
testcase_35 AC 5 ms
7,364 KB
testcase_36 AC 3 ms
4,920 KB
testcase_37 AC 4 ms
7,336 KB
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);
const int MOD = 1e9 + 7;

int dp[100+1][20000+1];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  REP (i, n) {
    cin >> a[i];
    a[i] -= k;
  }

  int offset = 10000;
  dp[0][0 + offset] = 1;

  REP (i, n) {
    for (int j = -10000; j <= 10000; j++) {
      dp[i+1][j + offset] = dp[i][j + offset];
      if (-10000 <= j - a[i] && j - a[i] <= 10000) {
        dp[i+1][j + offset] += dp[i][j - a[i] + offset];
      }
    }
  }

  int ret = MOD - 1;
  for (int i = 0; i <= 10000; i++) {
    ret += dp[n][i + offset];
    ret %= MOD;
  }
  
  cout << ret << endl;
    
  return 0;
}
0