結果

問題 No.1189 Sum is XOR
ユーザー rlangevinrlangevin
提出日時 2023-04-06 12:27:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 105,612 KB
最終ジャッジ日時 2024-04-10 10:07:13
合計ジャッジ時間 4,332 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 191 ms
105,492 KB
testcase_01 AC 186 ms
105,612 KB
testcase_02 AC 183 ms
105,388 KB
testcase_03 AC 52 ms
78,660 KB
testcase_04 AC 49 ms
75,836 KB
testcase_05 AC 60 ms
86,348 KB
testcase_06 AC 69 ms
98,024 KB
testcase_07 AC 56 ms
81,788 KB
testcase_08 AC 44 ms
68,328 KB
testcase_09 AC 44 ms
69,812 KB
testcase_10 AC 41 ms
66,080 KB
testcase_11 AC 154 ms
80,344 KB
testcase_12 AC 183 ms
105,524 KB
testcase_13 AC 184 ms
101,692 KB
testcase_14 AC 178 ms
91,352 KB
testcase_15 AC 157 ms
80,424 KB
testcase_16 AC 160 ms
77,348 KB
testcase_17 AC 163 ms
79,556 KB
testcase_18 AC 161 ms
84,780 KB
testcase_19 AC 178 ms
96,096 KB
testcase_20 AC 181 ms
95,964 KB
testcase_21 AC 154 ms
76,164 KB
testcase_22 AC 158 ms
76,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(m, m2):
    return m * M2 + m2

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
M = 11
M2 = 1 << M
if K >= M:
    print(0)
    exit()
D = [0] * M2
for a in A:
    D[a] += 1

ans = 0
dp = [0] * (M2 * (M + 1))
dp[0] = 1
for s in range(M2):
    for t in range(s, M2):
        for i in range(M):
            if s + t == s ^ t:
                dp[f(i + 1, s + t)] += dp[f(i, s)] * D[t]
                dp[f(i + 1, s + t)] %= mod

for i in range(M2):
    ans += dp[f(K, i)]
    ans %= mod

print(ans)
0