結果

問題 No.2561 みんな大好きmod 998
ユーザー yelyel
提出日時 2023-12-02 14:51:58
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 4,000 ms
コード長 903 bytes
コンパイル時間 2,941 ms
コンパイル使用メモリ 246,668 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-12-02 14:52:05
合計ジャッジ時間 5,165 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 4 ms
6,548 KB
testcase_02 AC 1 ms
6,548 KB
testcase_03 AC 74 ms
6,548 KB
testcase_04 AC 73 ms
6,548 KB
testcase_05 AC 73 ms
6,548 KB
testcase_06 AC 73 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 2 ms
6,548 KB
testcase_09 AC 2 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 13 ms
6,548 KB
testcase_12 AC 2 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 73 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
testcase_17 AC 2 ms
6,548 KB
testcase_18 AC 2 ms
6,548 KB
testcase_19 AC 52 ms
6,548 KB
testcase_20 AC 2 ms
6,548 KB
testcase_21 AC 2 ms
6,548 KB
testcase_22 AC 2 ms
6,548 KB
testcase_23 AC 2 ms
6,548 KB
testcase_24 AC 2 ms
6,548 KB
testcase_25 AC 2 ms
6,548 KB
testcase_26 AC 17 ms
6,548 KB
testcase_27 AC 73 ms
6,548 KB
testcase_28 AC 23 ms
6,548 KB
testcase_29 AC 7 ms
6,548 KB
testcase_30 AC 18 ms
6,548 KB
testcase_31 AC 36 ms
6,548 KB
testcase_32 AC 12 ms
6,548 KB
testcase_33 AC 7 ms
6,548 KB
testcase_34 AC 73 ms
6,548 KB
testcase_35 AC 8 ms
6,548 KB
testcase_36 AC 8 ms
6,548 KB
testcase_37 AC 4 ms
6,548 KB
testcase_38 AC 13 ms
6,548 KB
testcase_39 AC 17 ms
6,548 KB
testcase_40 AC 18 ms
6,548 KB
testcase_41 AC 13 ms
6,548 KB
testcase_42 AC 23 ms
6,548 KB
testcase_43 AC 4 ms
6,548 KB
testcase_44 AC 10 ms
6,548 KB
testcase_45 AC 52 ms
6,548 KB
testcase_46 AC 9 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
typedef long long ll;
typedef unsigned long long ull;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int MAX = 1e9;
const int MIN = -1*1e9;
const ll MAXLL = 1e18;
const ll MINLL = -1*1e18;
const ll MOD = 998244353;
//const ll MOD = 1000000007;
ll N,K,Ans=0;
vector<ll> V(30);

void dfs(int Step, int I, ll Count)
{
    if(Step > K || N-I < K-Step) return;
    if(I == N)
    {
        if(Step == K)
        {
            if(Count%998 >= Count%MOD) Ans++;
        }
        return;
    }
    dfs(Step+1,I+1,Count+V[I]);
    dfs(Step,I+1,Count);
}
int main()
{
    cin >> N >> K;
    for(int i = 0; i < N; i++)
    {
        cin >> V[i];
    }
    dfs(0,0,0);
    cout << Ans%998 << endl;
    return 0;
}
0