結果

問題 No.1189 Sum is XOR
ユーザー tikitaka1201
提出日時 2020-09-24 19:30:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 105,140 KB
最終ジャッジ日時 2024-06-28 05:17:11
合計ジャッジ時間 3,800 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353

if(k > 10):
    print(0)
    exit()
from collections import Counter
cnt=Counter(a)

dp=[[0] * (2**10) for _ in range(k+1)]
dp[0][0]=1

for x in range(2**10):
    for i in range(k):
        for y in range(2**10):        
            if(x&y)==0:
                dp[i+1][x|y] += dp[i][y] * cnt[x]
                dp[i+1][x|y] %= mod

ans = sum(dp[-1])%mod
print(ans)
0