結果

問題 No.1238 選抜クラス
ユーザー snow39snow39
提出日時 2020-09-25 21:33:08
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 778 ms / 2,000 ms
コード長 1,166 bytes
コンパイル時間 946 ms
コンパイル使用メモリ 102,444 KB
実行使用メモリ 18,964 KB
最終ジャッジ日時 2023-09-10 14:58:28
合計ジャッジ時間 13,977 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 3 ms
4,384 KB
testcase_02 AC 7 ms
4,616 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 7 ms
4,764 KB
testcase_09 AC 15 ms
5,372 KB
testcase_10 AC 6 ms
4,376 KB
testcase_11 AC 13 ms
5,388 KB
testcase_12 AC 9 ms
4,880 KB
testcase_13 AC 8 ms
4,884 KB
testcase_14 AC 7 ms
4,644 KB
testcase_15 AC 14 ms
5,612 KB
testcase_16 AC 12 ms
5,484 KB
testcase_17 AC 778 ms
18,860 KB
testcase_18 AC 729 ms
18,452 KB
testcase_19 AC 737 ms
18,624 KB
testcase_20 AC 721 ms
18,072 KB
testcase_21 AC 661 ms
17,728 KB
testcase_22 AC 768 ms
18,940 KB
testcase_23 AC 746 ms
18,956 KB
testcase_24 AC 725 ms
18,952 KB
testcase_25 AC 747 ms
18,964 KB
testcase_26 AC 744 ms
18,912 KB
testcase_27 AC 727 ms
18,888 KB
testcase_28 AC 726 ms
18,884 KB
testcase_29 AC 704 ms
18,652 KB
testcase_30 AC 57 ms
8,076 KB
testcase_31 AC 197 ms
11,996 KB
testcase_32 AC 415 ms
15,472 KB
testcase_33 AC 5 ms
4,380 KB
testcase_34 AC 523 ms
16,520 KB
testcase_35 AC 93 ms
9,440 KB
testcase_36 AC 23 ms
6,280 KB
testcase_37 AC 68 ms
8,296 KB
testcase_38 AC 661 ms
18,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

void add(ll &a,ll b){
  a=(a+b)%MOD;
}

void mul(ll &a,ll b){
  a%=MOD;b%=MOD;
  a=a*b%MOD;
}

const int L=1e4;

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

  int N,K;
  cin>>N>>K;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  vector<vector<ll>> dp(N+1,vector<ll> (L+1,0));
  dp[0][0]=1;
  for(int i=0;i<N;i++){
    vector<vector<ll>> ndp(N+1,vector<ll> (L+1,0));
    for(int j=0;j<=i;j++) for(int k=0;k<=L;k++){
      if(dp[j][k]==0) continue;
      add(ndp[j][k],dp[j][k]);
      add(ndp[j+1][k+A[i]],dp[j][k]);
    }
    dp=ndp;
  }

  ll ans=0;
  for(int j=1;j<=N;j++) for(int k=0;k<=L;k++){
    if(K*j<=k) add(ans,dp[j][k]);
  }
  cout<<ans<<endl;

  return 0;
}
0