結果

問題 No.1189 Sum is XOR
ユーザー hir355hir355
提出日時 2020-08-22 14:48:52
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 670 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 168,144 KB
最終ジャッジ日時 2024-04-23 09:13:54
合計ジャッジ時間 6,473 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 372 ms
145,060 KB
testcase_01 AC 258 ms
120,364 KB
testcase_02 AC 232 ms
111,420 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 257 ms
127,208 KB
testcase_12 AC 230 ms
111,824 KB
testcase_13 AC 359 ms
144,376 KB
testcase_14 AC 334 ms
144,032 KB
testcase_15 AC 370 ms
151,888 KB
testcase_16 AC 437 ms
168,144 KB
testcase_17 AC 293 ms
135,032 KB
testcase_18 AC 259 ms
118,796 KB
testcase_19 AC 380 ms
144,120 KB
testcase_20 AC 419 ms
160,664 KB
testcase_21 AC 66 ms
70,224 KB
testcase_22 AC 62 ms
67,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
MOD = 998244353
n, k = map(int, input().split())
if k > 10:
    print(0)
else:
    a = list(map(int, input().split()))
    c = tuple(Counter(a).items())
    n = len(c)
    dp = [[[0] * 1024 for _ in range(n + 1)] for i in range(k + 1)]
    dp[0][0][0] = 1
    for i in range(n):
        kt, vt = c[i]
        for j in range(1024):
            for ka in range(k + 1):
                dp[ka][i + 1][j] += dp[ka][i][j]
                if (j & kt) == 0 and ka < k:
                    dp[ka + 1][i + 1][j ^ kt] += dp[ka][i][j] * vt
                dp[ka][i + 1][j] %= MOD
ans = 0
for i in range(1024):
    ans += dp[k][n][i]
print(ans % MOD)
0