結果

問題 No.1238 選抜クラス
ユーザー ぷらぷら
提出日時 2020-09-25 21:52:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 766 ms / 2,000 ms
コード長 880 bytes
コンパイル時間 1,710 ms
コンパイル使用メモリ 164,496 KB
実行使用メモリ 495,924 KB
最終ジャッジ日時 2023-09-10 15:18:48
合計ジャッジ時間 15,050 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,388 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 13 ms
9,276 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 7 ms
5,692 KB
testcase_08 AC 13 ms
9,216 KB
testcase_09 AC 25 ms
17,456 KB
testcase_10 AC 9 ms
6,068 KB
testcase_11 AC 23 ms
15,000 KB
testcase_12 AC 15 ms
10,200 KB
testcase_13 AC 15 ms
10,264 KB
testcase_14 AC 13 ms
9,268 KB
testcase_15 AC 25 ms
17,408 KB
testcase_16 AC 23 ms
14,904 KB
testcase_17 AC 766 ms
480,592 KB
testcase_18 AC 711 ms
471,192 KB
testcase_19 AC 722 ms
479,264 KB
testcase_20 AC 689 ms
454,108 KB
testcase_21 AC 644 ms
428,792 KB
testcase_22 AC 757 ms
495,596 KB
testcase_23 AC 743 ms
495,592 KB
testcase_24 AC 758 ms
495,592 KB
testcase_25 AC 746 ms
495,692 KB
testcase_26 AC 754 ms
495,700 KB
testcase_27 AC 746 ms
495,924 KB
testcase_28 AC 751 ms
495,700 KB
testcase_29 AC 725 ms
479,408 KB
testcase_30 AC 91 ms
63,012 KB
testcase_31 AC 260 ms
174,568 KB
testcase_32 AC 469 ms
313,436 KB
testcase_33 AC 7 ms
5,432 KB
testcase_34 AC 561 ms
373,548 KB
testcase_35 AC 137 ms
92,764 KB
testcase_36 AC 39 ms
26,180 KB
testcase_37 AC 104 ms
69,780 KB
testcase_38 AC 683 ms
454,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 5e18+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
long double pi = 3.141592653589793238;
int dp[110][110][10010];
signed main() {
    int N,K;
    cin >> N >> K;
    dp[0][0][0] = 1;
    for(int i = 0; i < N; i++) {
        int A;
        cin >> A;
        for(int j = 0; j <= i; j++) {
            for(int k = 0; k <= 10000; k++) {
                dp[i+1][j][k] += dp[i][j][k];
                if(k+A <= 10000) {
                    dp[i+1][j+1][k+A] += dp[i][j][k];
                }
                dp[i+1][j][k] %= mod;
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= N; i++) {
        for(int j = K*i; j <= 10000; j++) {
            ans += dp[N][i][j];
            ans %= mod;
        }
    }
    cout << ans << endl;
}
0