結果

問題 No.1189 Sum is XOR
ユーザー H20
提出日時 2022-01-19 13:25:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 112,000 KB
最終ジャッジ日時 2024-11-23 13:48:21
合計ジャッジ時間 6,348 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
from importlib.resources import read_binary
N,K = map(int,input().split())
if K>10:
    print(0)
    exit()
A = list(map(int,input().split()))
CA = collections.Counter(A)
mod = 998244353
DP = [[0]*(2**10+1) for _ in range(K+1)]
DP[0][0]=1
for k,v in CA.items():
    for i in reversed(range(K)):
        for j in reversed(range(2**10)):
            if k&j==0:
                DP[i+1][j^k] = (DP[i+1][j^k] + DP[i][j]*v)%mod
print(sum(DP[K])%mod)

0