結果

問題 No.1238 選抜クラス
ユーザー ぷらぷら
提出日時 2020-09-25 21:53:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 516 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 1,667 ms
コンパイル使用メモリ 165,396 KB
実行使用メモリ 205,268 KB
最終ジャッジ日時 2023-09-10 15:20:00
合計ジャッジ時間 11,233 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 8 ms
5,456 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 5 ms
4,448 KB
testcase_08 AC 7 ms
5,708 KB
testcase_09 AC 15 ms
8,116 KB
testcase_10 AC 6 ms
4,764 KB
testcase_11 AC 13 ms
7,580 KB
testcase_12 AC 9 ms
5,892 KB
testcase_13 AC 9 ms
5,928 KB
testcase_14 AC 7 ms
5,600 KB
testcase_15 AC 14 ms
8,068 KB
testcase_16 AC 13 ms
7,504 KB
testcase_17 AC 514 ms
205,072 KB
testcase_18 AC 483 ms
193,384 KB
testcase_19 AC 490 ms
197,188 KB
testcase_20 AC 467 ms
185,788 KB
testcase_21 AC 434 ms
174,584 KB
testcase_22 AC 516 ms
205,116 KB
testcase_23 AC 510 ms
205,136 KB
testcase_24 AC 512 ms
205,156 KB
testcase_25 AC 512 ms
205,268 KB
testcase_26 AC 515 ms
205,232 KB
testcase_27 AC 507 ms
205,068 KB
testcase_28 AC 510 ms
205,132 KB
testcase_29 AC 492 ms
197,272 KB
testcase_30 AC 53 ms
22,836 KB
testcase_31 AC 163 ms
66,212 KB
testcase_32 AC 308 ms
124,256 KB
testcase_33 AC 5 ms
4,428 KB
testcase_34 AC 375 ms
149,940 KB
testcase_35 AC 82 ms
34,120 KB
testcase_36 AC 21 ms
10,864 KB
testcase_37 AC 59 ms
25,420 KB
testcase_38 AC 461 ms
185,760 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:15: 警告: overflow in conversion from ‘double’ to ‘int’ changes value from ‘5.0e+18’ to ‘2147483647’ [-Woverflow]
    4 | int INF = 5e18+7;
      |           ~~~~^~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
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];
int 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];
                dp[i+1][j][k] %= mod;
                if(k+A <= 10000) {
                    dp[i+1][j+1][k+A] += dp[i][j][k];
                    dp[i+1][j+1][k+A] %= 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