結果

問題 No.1238 選抜クラス
ユーザー CleyLCleyL
提出日時 2023-06-29 15:56:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 80,388 KB
実行使用メモリ 7,584 KB
最終ジャッジ日時 2023-09-20 11:17:28
合計ジャッジ時間 2,946 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 3 ms
4,384 KB
testcase_17 AC 10 ms
7,388 KB
testcase_18 AC 10 ms
7,380 KB
testcase_19 AC 10 ms
7,188 KB
testcase_20 AC 9 ms
7,080 KB
testcase_21 AC 9 ms
6,960 KB
testcase_22 AC 11 ms
7,324 KB
testcase_23 AC 10 ms
7,312 KB
testcase_24 AC 10 ms
7,268 KB
testcase_25 AC 11 ms
7,312 KB
testcase_26 AC 10 ms
7,232 KB
testcase_27 AC 10 ms
7,584 KB
testcase_28 AC 9 ms
7,320 KB
testcase_29 AC 9 ms
7,304 KB
testcase_30 AC 4 ms
4,660 KB
testcase_31 AC 6 ms
5,496 KB
testcase_32 AC 8 ms
6,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 9 ms
6,812 KB
testcase_35 AC 5 ms
4,844 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 5 ms
4,608 KB
testcase_38 AC 9 ms
7,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const long long MOD = 1000000007;
int dp[110][10010];
int main(){
  int n,k;cin>>n>>k;
  vector<int> A(n);
  for(int i = 0; n > i; i++){
    cin>>A[i];
    A[i]-=k;
  }
  sort(A.begin(), A.end(), greater<int>());
  dp[0][0] = 1;
  for(int i = 0; n > i; i++){
    for(int j = 0; 10000 >= j; j++){
      if(j+A[i] >= 0)dp[i+1][j+A[i]] = (dp[i+1][j+A[i]]+dp[i][j])%MOD;
      dp[i+1][j] = (dp[i+1][j]+dp[i][j])%MOD;
    }
  }
  long long ans = MOD - 1;
  for(int i = 0; 10000 >= i; i++){
    ans = (ans+dp[n][i])%MOD;
  }
  cout << ans << endl;
}
0