結果

問題 No.1189 Sum is XOR
ユーザー KudeKude
提出日時 2020-08-28 03:01:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 89,984 KB
最終ジャッジ日時 2024-04-26 10:26:48
合計ジャッジ時間 3,222 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
89,344 KB
testcase_01 AC 107 ms
89,984 KB
testcase_02 AC 104 ms
89,600 KB
testcase_03 AC 58 ms
70,528 KB
testcase_04 AC 56 ms
69,376 KB
testcase_05 AC 64 ms
76,160 KB
testcase_06 AC 73 ms
84,352 KB
testcase_07 AC 61 ms
72,192 KB
testcase_08 AC 52 ms
63,616 KB
testcase_09 AC 52 ms
64,384 KB
testcase_10 AC 49 ms
62,464 KB
testcase_11 AC 87 ms
68,608 KB
testcase_12 AC 103 ms
89,088 KB
testcase_13 AC 114 ms
86,144 KB
testcase_14 AC 104 ms
77,696 KB
testcase_15 AC 97 ms
68,736 KB
testcase_16 AC 101 ms
66,944 KB
testcase_17 AC 89 ms
68,096 KB
testcase_18 AC 88 ms
72,704 KB
testcase_19 AC 109 ms
81,920 KB
testcase_20 AC 116 ms
82,176 KB
testcase_21 AC 69 ms
62,720 KB
testcase_22 AC 69 ms
62,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n, k = map(int, input().split())
d = [0] * 2 ** 10
for a in map(int, input().split()):
    d[a] += 1
if k > 10:
    print(0)
    exit()
dp = [0] * 2 ** 10
dp[0] = 1
for _ in range(k):
    ndp = [0] * 2 ** 10
    for i in range(2**10):
        for j in range(1, 2**10):
            if i & j:
                continue
            ndp[i|j] += dp[i] * d[j]
            ndp[i|j] %= MOD
    dp = ndp
fact = 1
for x in range(1, k+1):
    fact *= x
    fact %= MOD
ans = sum(dp) * pow(fact, MOD-2, MOD) % MOD
print(ans)
0