結果

問題 No.1238 選抜クラス
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-23 02:57:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 1,083 bytes
コンパイル時間 1,087 ms
コンパイル使用メモリ 111,844 KB
実行使用メモリ 18,992 KB
最終ジャッジ日時 2023-09-07 09:02:29
合計ジャッジ時間 12,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 7 ms
4,716 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 7 ms
4,604 KB
testcase_09 AC 13 ms
5,356 KB
testcase_10 AC 5 ms
4,404 KB
testcase_11 AC 12 ms
5,436 KB
testcase_12 AC 8 ms
4,920 KB
testcase_13 AC 8 ms
4,820 KB
testcase_14 AC 7 ms
4,708 KB
testcase_15 AC 13 ms
5,352 KB
testcase_16 AC 12 ms
5,484 KB
testcase_17 AC 558 ms
18,936 KB
testcase_18 AC 529 ms
18,344 KB
testcase_19 AC 537 ms
18,596 KB
testcase_20 AC 510 ms
18,088 KB
testcase_21 AC 488 ms
17,696 KB
testcase_22 AC 576 ms
18,972 KB
testcase_23 AC 578 ms
18,848 KB
testcase_24 AC 568 ms
18,856 KB
testcase_25 AC 585 ms
18,992 KB
testcase_26 AC 572 ms
18,896 KB
testcase_27 AC 570 ms
18,904 KB
testcase_28 AC 580 ms
18,948 KB
testcase_29 AC 556 ms
18,664 KB
testcase_30 AC 50 ms
8,132 KB
testcase_31 AC 165 ms
11,936 KB
testcase_32 AC 327 ms
15,484 KB
testcase_33 AC 5 ms
4,376 KB
testcase_34 AC 393 ms
16,528 KB
testcase_35 AC 78 ms
9,252 KB
testcase_36 AC 20 ms
6,416 KB
testcase_37 AC 55 ms
8,316 KB
testcase_38 AC 520 ms
18,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

const long long modc = 1e9+7;

int main(){

    long long N, K, ans=0;
    cin >> N >> K;

    vector<long long> A(N+1);
    for (int i=1; i<=N; i++) cin >> A[i];

    vector<vector<long long>> dp(N+1, vector<long long>(10001));
    dp[0][0] = 1;

    for (int i=1; i<=N; i++){
        vector<vector<long long>> pd(N+1, vector<long long>(10001));
        for (int j=0; j<=N; j++){
            for (int k=0; k<=10000; k++){
                pd[j][k] += dp[j][k];
                if (j>=1 && k>=A[i]) pd[j][k] += dp[j-1][k-A[i]];
                pd[j][k] %= modc;
            }
        }
        swap(dp, pd);
    }

    for (int i=1; i<=N; i++){
        for (int j=0; j<=10000; j++){
            if (j >= K*i){
                ans += dp[i][j];
                ans %= modc;
            }
        }
    }

    cout << ans << endl;

    return 0;
}
0