結果

問題 No.1238 選抜クラス
ユーザー snrnsidysnrnsidy
提出日時 2021-11-13 01:57:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 1,006 bytes
コンパイル時間 2,168 ms
コンパイル使用メモリ 200,108 KB
実行使用メモリ 11,444 KB
最終ジャッジ日時 2023-08-17 11:42:04
合計ジャッジ時間 6,415 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
11,276 KB
testcase_01 AC 5 ms
11,212 KB
testcase_02 AC 6 ms
11,208 KB
testcase_03 AC 5 ms
11,260 KB
testcase_04 AC 5 ms
11,232 KB
testcase_05 AC 5 ms
11,264 KB
testcase_06 AC 6 ms
11,264 KB
testcase_07 AC 6 ms
11,276 KB
testcase_08 AC 6 ms
11,212 KB
testcase_09 AC 9 ms
11,272 KB
testcase_10 AC 5 ms
11,260 KB
testcase_11 AC 8 ms
11,364 KB
testcase_12 AC 7 ms
11,280 KB
testcase_13 AC 7 ms
11,252 KB
testcase_14 AC 7 ms
11,284 KB
testcase_15 AC 8 ms
11,248 KB
testcase_16 AC 7 ms
11,264 KB
testcase_17 AC 171 ms
11,240 KB
testcase_18 AC 162 ms
11,252 KB
testcase_19 AC 165 ms
11,340 KB
testcase_20 AC 154 ms
11,444 KB
testcase_21 AC 145 ms
11,268 KB
testcase_22 AC 170 ms
11,240 KB
testcase_23 AC 171 ms
11,280 KB
testcase_24 AC 169 ms
11,240 KB
testcase_25 AC 169 ms
11,276 KB
testcase_26 AC 169 ms
11,252 KB
testcase_27 AC 169 ms
11,236 KB
testcase_28 AC 171 ms
11,368 KB
testcase_29 AC 164 ms
11,272 KB
testcase_30 AC 20 ms
11,260 KB
testcase_31 AC 55 ms
11,440 KB
testcase_32 AC 104 ms
11,296 KB
testcase_33 AC 5 ms
11,236 KB
testcase_34 AC 125 ms
11,276 KB
testcase_35 AC 30 ms
11,296 KB
testcase_36 AC 11 ms
11,364 KB
testcase_37 AC 22 ms
11,252 KB
testcase_38 AC 155 ms
11,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
 
using namespace std;
    
const long long int MOD = 1e9 + 7;
int n,k,t;
vector <int> v;
long long int dp[101][10001];

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

    cin >> n >> k;

    for(int i=0;i<n;i++)
    {
        cin >> t;
        v.push_back(t);
    }

    memset(dp,0,sizeof(dp));

    dp[0][0] = 1;

    for(int i=0;i<n;i++)
    {
        for(int j=n-1;j>=0;j--)
        {
            for(int x=0;x<=10000;x++)
            {
                int xx = x + v[i];
                if(xx > 10000) break;
                dp[j+1][xx] += dp[j][x];
                dp[j+1][xx]%=MOD; 
            }
        }
    }

    long long int res = 0;

    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=10000;j++)
        {
            if(dp[i][j] > 0 && j >= i*k)
            {
                //cout << i << ' ' << j << '\n';
                res += dp[i][j];
                res%=MOD;
            }
        }
    }

    cout << res << '\n';

    return 0;
}
0