結果

問題 No.1189 Sum is XOR
ユーザー 37zigen37zigen
提出日時 2020-08-26 21:15:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 104,960 KB
最終ジャッジ日時 2024-04-25 03:48:06
合計ジャッジ時間 3,771 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
104,960 KB
testcase_01 AC 133 ms
104,704 KB
testcase_02 AC 134 ms
104,832 KB
testcase_03 AC 82 ms
81,920 KB
testcase_04 AC 80 ms
79,744 KB
testcase_05 AC 92 ms
91,008 KB
testcase_06 AC 112 ms
104,704 KB
testcase_07 AC 82 ms
84,608 KB
testcase_08 AC 66 ms
70,144 KB
testcase_09 AC 70 ms
71,296 KB
testcase_10 AC 64 ms
68,096 KB
testcase_11 AC 101 ms
77,056 KB
testcase_12 AC 131 ms
104,960 KB
testcase_13 AC 131 ms
101,248 KB
testcase_14 AC 116 ms
91,392 KB
testcase_15 AC 94 ms
76,928 KB
testcase_16 AC 90 ms
71,808 KB
testcase_17 AC 94 ms
74,752 KB
testcase_18 AC 104 ms
84,736 KB
testcase_19 AC 123 ms
96,128 KB
testcase_20 AC 123 ms
96,384 KB
testcase_21 AC 65 ms
63,616 KB
testcase_22 AC 65 ms
63,360 KB
権限があれば一括ダウンロードができます

ソースコード

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