結果

問題 No.1238 選抜クラス
ユーザー kkktymkkktym
提出日時 2020-11-25 13:47:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,054 ms / 2,000 ms
コード長 2,380 bytes
コンパイル時間 1,245 ms
コンパイル使用メモリ 105,876 KB
実行使用メモリ 35,312 KB
最終ジャッジ日時 2023-10-01 01:46:00
合計ジャッジ時間 18,739 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 AC 4 ms
4,580 KB
testcase_02 AC 10 ms
6,400 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,376 KB
testcase_07 AC 7 ms
5,384 KB
testcase_08 AC 10 ms
6,256 KB
testcase_09 AC 21 ms
7,908 KB
testcase_10 AC 8 ms
5,708 KB
testcase_11 AC 18 ms
7,612 KB
testcase_12 AC 12 ms
6,704 KB
testcase_13 AC 12 ms
6,884 KB
testcase_14 AC 10 ms
6,408 KB
testcase_15 AC 21 ms
7,936 KB
testcase_16 AC 18 ms
7,532 KB
testcase_17 AC 1,025 ms
35,164 KB
testcase_18 AC 963 ms
34,108 KB
testcase_19 AC 992 ms
34,524 KB
testcase_20 AC 919 ms
33,660 KB
testcase_21 AC 861 ms
32,524 KB
testcase_22 AC 1,008 ms
35,076 KB
testcase_23 AC 993 ms
35,292 KB
testcase_24 AC 1,018 ms
35,220 KB
testcase_25 AC 1,028 ms
35,312 KB
testcase_26 AC 1,054 ms
35,284 KB
testcase_27 AC 1,032 ms
35,132 KB
testcase_28 AC 1,006 ms
35,156 KB
testcase_29 AC 979 ms
34,640 KB
testcase_30 AC 77 ms
13,052 KB
testcase_31 AC 292 ms
20,988 KB
testcase_32 AC 598 ms
27,904 KB
testcase_33 AC 6 ms
5,412 KB
testcase_34 AC 732 ms
30,332 KB
testcase_35 AC 132 ms
15,440 KB
testcase_36 AC 30 ms
9,340 KB
testcase_37 AC 96 ms
13,724 KB
testcase_38 AC 929 ms
33,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
template<class T> inline int  sz(T &a) { return a.size(); }
using ll = long long; using ld = long double;
using pi = pair<int,int>; using pl = pair<ll,ll>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
const int inf = numeric_limits<int>::max();
const ll infll = numeric_limits<ll>::max();
// Modint
// modint<MOD> で宣言
template<ll MOD>
struct modint{
  ll x;
  ll mod = MOD;
  modint(ll x=0):x(x%MOD){}
  modint& operator+=(const modint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  modint& operator-=(const modint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  modint& operator*=(const modint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  modint operator+(const modint a) const{
    modint res(*this);
    return res+=a;
  }
  modint operator-(const modint a) const{
    modint res(*this);
    return res-=a;
  }
  modint operator*(const modint a) const{
    modint res(*this);
    return res*=a;
  }
  modint pow(ll t) const{
    if(!t) return 1;
    modint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  modint inv() const{
    return pow(MOD-2);
  }
  modint& operator/=(const modint a){
    return (*this) *= a.inv();
  }
  modint operator/(const modint a) const{
    modint res(*this);
    return res/=a;
  }
};
using mint = modint<1000000007>;

int main()
{
  int n,k; cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];

  vector<vector<mint>> dp1(n+1, vector<mint>(10001));
  dp1[0][0].x = 1;
  rep(c,n) {
    vector<vector<mint>> dp2(n+1, vector<mint>(10001));    
    rep(i,n) {
      rep(j,10001) {
	if(j + a[c] <= 10000) {
	  dp2[i+1][j+a[c]] += dp1[i][j];
	}
	dp2[i][j] += dp1[i][j];
      }
    }
    swap(dp1, dp2);
  }
  mint res;
  rep1(i,n) {
    rep(j,10001) {
      if(j / i >= k) res += dp1[i][j];
    }
  }
  cout << res.x << "\n";
  return 0;
}
0