結果

問題 No.1238 選抜クラス
ユーザー didi just isdidi just is
提出日時 2023-01-07 17:36:01
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 4,640 ms
コンパイル使用メモリ 130,112 KB
実行使用メモリ 23,084 KB
最終ジャッジ日時 2023-08-21 07:38:16
合計ジャッジ時間 7,733 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,528 KB
testcase_01 AC 2 ms
5,484 KB
testcase_02 AC 3 ms
5,580 KB
testcase_03 AC 2 ms
5,444 KB
testcase_04 AC 2 ms
5,504 KB
testcase_05 AC 2 ms
5,552 KB
testcase_06 AC 2 ms
5,508 KB
testcase_07 AC 2 ms
5,604 KB
testcase_08 AC 2 ms
5,592 KB
testcase_09 AC 3 ms
5,600 KB
testcase_10 AC 2 ms
5,608 KB
testcase_11 AC 3 ms
5,648 KB
testcase_12 AC 2 ms
5,656 KB
testcase_13 AC 3 ms
7,704 KB
testcase_14 AC 2 ms
5,544 KB
testcase_15 AC 2 ms
5,712 KB
testcase_16 AC 3 ms
7,684 KB
testcase_17 AC 60 ms
16,864 KB
testcase_18 AC 54 ms
16,592 KB
testcase_19 AC 53 ms
16,500 KB
testcase_20 AC 51 ms
18,280 KB
testcase_21 AC 47 ms
17,364 KB
testcase_22 AC 4 ms
12,128 KB
testcase_23 AC 4 ms
12,148 KB
testcase_24 AC 115 ms
21,672 KB
testcase_25 AC 111 ms
23,084 KB
testcase_26 AC 59 ms
16,884 KB
testcase_27 AC 57 ms
18,824 KB
testcase_28 AC 53 ms
18,084 KB
testcase_29 AC 53 ms
18,484 KB
testcase_30 AC 4 ms
8,108 KB
testcase_31 AC 14 ms
11,220 KB
testcase_32 AC 28 ms
15,816 KB
testcase_33 AC 2 ms
5,588 KB
testcase_34 AC 40 ms
15,828 KB
testcase_35 AC 6 ms
8,680 KB
testcase_36 AC 3 ms
5,684 KB
testcase_37 AC 5 ms
8,108 KB
testcase_38 AC 51 ms
16,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=110,mod=1e9+7;
int n,m,k;
int f[3][N][N*N];
int a[N];
inline void solve(){
    cin>>n>>k;
    int sum=0;
    for(int i=1;i<=n;i++) cin>>a[i],sum+=a[i];

    f[0][0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            for(int z=0;z<=sum;z++){
                int &x=f[i&1][j][z];
                x=f[(i-1)&1][j][z];
                if(z>=a[i]&&j>=1) x=(x+f[(i-1)&1][j-1][z-a[i]])%mod;
            }
        }
    }
    int res=0;
    for(int i=1;i<=n;i++){
        for(int j=i*k;j<=sum;j++){
            res=(res+f[n&1][i][j])%mod;
        }
    }
    cout<<res<<endl;
}
signed main(){
    int T=1; //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}
0