結果

問題 No.1189 Sum is XOR
ユーザー 37zigen
提出日時 2020-08-26 21:15:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 104,832 KB
最終ジャッジ日時 2024-11-07 13:39:14
合計ジャッジ時間 3,548 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
MOD=998244353
N,K=map(int,input().split())
A=collections.Counter(list(map(int,input().split())))
if K>10:
    exit(print(0))
dp=[[0]*11 for _ in range(1<<10)]
dp[0][0]=1
for a in A:
    s=(~a)&((1<<10)-1)
    while True:
        for i in range(10):
            dp[a|s][i+1]=(dp[a|s][i+1]+dp[s][i]*A[a])%MOD
        if s==0:
            break
        s=(s-1)&(~a)
ans=0
for i in range(1,1<<10):
    ans=(ans+dp[i][K])%MOD
print(ans)
0