結果

問題 No.1189 Sum is XOR
ユーザー H3PO4H3PO4
提出日時 2021-11-27 08:18:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 93,756 KB
最終ジャッジ日時 2023-09-12 12:13:40
合計ジャッジ時間 5,731 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
93,476 KB
testcase_01 AC 136 ms
93,756 KB
testcase_02 AC 138 ms
93,752 KB
testcase_03 AC 109 ms
84,212 KB
testcase_04 AC 111 ms
83,256 KB
testcase_05 AC 118 ms
87,884 KB
testcase_06 AC 126 ms
92,788 KB
testcase_07 AC 112 ms
85,072 KB
testcase_08 AC 105 ms
79,412 KB
testcase_09 AC 106 ms
79,800 KB
testcase_10 AC 103 ms
78,616 KB
testcase_11 AC 117 ms
79,944 KB
testcase_12 AC 142 ms
93,536 KB
testcase_13 AC 139 ms
91,716 KB
testcase_14 AC 129 ms
85,800 KB
testcase_15 AC 120 ms
79,604 KB
testcase_16 AC 121 ms
78,236 KB
testcase_17 AC 117 ms
79,464 KB
testcase_18 AC 120 ms
81,936 KB
testcase_19 AC 134 ms
88,680 KB
testcase_20 AC 134 ms
88,412 KB
testcase_21 AC 105 ms
77,484 KB
testcase_22 AC 106 ms
77,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter

N, K = map(int, input().split())
A = Counter(map(int, input().split()))
MOD = 998244353

if K > 10: print(0);exit()

dp = [[0] * (1 << 10) for _ in range(K + 1)]
dp[0][0] = 1
for k, v in A.items():
    for b in range(1 << 10):
        if not k & b:
            for n in range(K):
                dp[n + 1][k ^ b] += dp[n][b] * v
                dp[n + 1][k ^ b] %= MOD
print(sum(dp[K]) % MOD)
0