結果

問題 No.2561 みんな大好きmod 998
ユーザー suminoeno7suminoeno7
提出日時 2023-12-02 15:57:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,606 ms / 4,000 ms
コード長 676 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 72,972 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-02 15:58:15
合計ジャッジ時間 22,200 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 16 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1,592 ms
6,676 KB
testcase_04 AC 1,606 ms
6,676 KB
testcase_05 AC 1,584 ms
6,676 KB
testcase_06 AC 1,586 ms
6,676 KB
testcase_07 AC 167 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 204 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 43 ms
6,676 KB
testcase_14 AC 83 ms
6,676 KB
testcase_15 AC 1,584 ms
6,676 KB
testcase_16 AC 166 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 3 ms
6,676 KB
testcase_19 AC 863 ms
6,676 KB
testcase_20 AC 12 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 382 ms
6,676 KB
testcase_27 AC 1,579 ms
6,676 KB
testcase_28 AC 736 ms
6,676 KB
testcase_29 AC 61 ms
6,676 KB
testcase_30 AC 139 ms
6,676 KB
testcase_31 AC 451 ms
6,676 KB
testcase_32 AC 1,377 ms
6,676 KB
testcase_33 AC 62 ms
6,676 KB
testcase_34 AC 1,592 ms
6,676 KB
testcase_35 AC 348 ms
6,676 KB
testcase_36 AC 348 ms
6,676 KB
testcase_37 AC 51 ms
6,676 KB
testcase_38 AC 203 ms
6,676 KB
testcase_39 AC 140 ms
6,676 KB
testcase_40 AC 140 ms
6,676 KB
testcase_41 AC 201 ms
6,676 KB
testcase_42 AC 751 ms
6,676 KB
testcase_43 AC 50 ms
6,676 KB
testcase_44 AC 111 ms
6,676 KB
testcase_45 AC 863 ms
6,676 KB
testcase_46 AC 679 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<bitset>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<long long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int m1 = 998, m2 = 998244353;
    long long res = 0;
    for (long long i = 0; i < (1LL << n); i++) {
        bitset<28> I(i);
        //cout << I << endl;
        if (I.count() != k) continue;
        //cout << I << endl;
        long long sum = 0;
        for (int j = 0; j < n; j++) {
            if (I.test(j)) sum += a[j];
        }
        //cout << sum << endl;
        if (sum % m2 <= sum % m1) res++;
    }
    res %= 998;
    cout << res << endl;
}
0