結果

問題 No.1189 Sum is XOR
ユーザー 👑 H20H20
提出日時 2022-01-19 13:25:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 112,000 KB
最終ジャッジ日時 2024-05-02 19:45:33
合計ジャッジ時間 6,148 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 218 ms
111,744 KB
testcase_01 AC 202 ms
111,744 KB
testcase_02 AC 196 ms
111,744 KB
testcase_03 AC 125 ms
81,024 KB
testcase_04 AC 121 ms
80,768 KB
testcase_05 AC 125 ms
81,152 KB
testcase_06 AC 125 ms
80,896 KB
testcase_07 AC 122 ms
80,768 KB
testcase_08 AC 123 ms
80,896 KB
testcase_09 AC 124 ms
80,896 KB
testcase_10 AC 122 ms
81,152 KB
testcase_11 AC 174 ms
86,912 KB
testcase_12 AC 199 ms
112,000 KB
testcase_13 AC 212 ms
108,544 KB
testcase_14 AC 202 ms
98,048 KB
testcase_15 AC 193 ms
87,168 KB
testcase_16 AC 201 ms
84,352 KB
testcase_17 AC 175 ms
86,400 KB
testcase_18 AC 175 ms
91,520 KB
testcase_19 AC 206 ms
102,784 KB
testcase_20 AC 227 ms
102,784 KB
testcase_21 AC 133 ms
81,792 KB
testcase_22 AC 134 ms
81,792 KB
権限があれば一括ダウンロードができます

ソースコード

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