結果

問題 No.1189 Sum is XOR
ユーザー ぷらぷら
提出日時 2021-03-16 01:30:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 845 bytes
コンパイル時間 1,913 ms
コンパイル使用メモリ 165,984 KB
実行使用メモリ 105,984 KB
最終ジャッジ日時 2024-04-25 03:56:17
合計ジャッジ時間 6,337 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
105,856 KB
testcase_01 AC 177 ms
105,984 KB
testcase_02 AC 178 ms
105,984 KB
testcase_03 AC 153 ms
105,984 KB
testcase_04 AC 152 ms
105,984 KB
testcase_05 AC 165 ms
105,728 KB
testcase_06 AC 177 ms
105,856 KB
testcase_07 AC 159 ms
105,984 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 144 ms
105,984 KB
testcase_12 AC 181 ms
105,856 KB
testcase_13 AC 171 ms
105,984 KB
testcase_14 AC 159 ms
105,984 KB
testcase_15 AC 145 ms
105,984 KB
testcase_16 AC 140 ms
105,984 KB
testcase_17 AC 143 ms
105,856 KB
testcase_18 AC 148 ms
105,984 KB
testcase_19 AC 166 ms
105,984 KB
testcase_20 AC 167 ms
105,856 KB
testcase_21 AC 137 ms
105,984 KB
testcase_22 AC 135 ms
105,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int mod = 998244353;
long long dp[1 << 11][1 << 11][12];

int main() {
    int N,K;
    cin >> N >> K;
    vector<int>A(1025);
    for(int i = 0; i < N; i++) {
        int a;
        cin >> a;
        A[a]++;
    }
    dp[0][0][0] = 1;
    for(int i = 0; i < (1 << 10); i++) {
        for(int j = 0; j < (1 << 10); j++) {
            for(int k = 0; k <= 10; k++) {
                dp[i+1][j][k] += dp[i][j][k];
                dp[i+1][j][k] %= mod;
                if(!(i & j)) {
                    dp[i+1][i+j][k+1] += dp[i][j][k]*A[i]%mod;
                    dp[i+1][i+j][k+1] %= mod;
                }
            }
        }
    }
    long long ans = 0;
    for(int i = 0; i < (1 << 10); i++) {
        ans += dp[(1 << 10)-1][i][K];
        ans %= mod;
    }
    cout << ans << endl;
}
0