結果

問題 No.1189 Sum is XOR
ユーザー lloyzlloyz
提出日時 2023-10-29 01:56:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 143,612 KB
最終ジャッジ日時 2023-10-29 01:56:15
合計ジャッジ時間 5,554 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 35 ms
53,604 KB
testcase_22 AC 35 ms
53,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353

D = [[] for _ in range(10)]
for i in range(n):
    ai = A[i]
    for j in range(10):
        if ai % 2 == 1:
            D[j].append(i)
        ai //= 2

fact = [1] * (n + 1)
inv = [1] * (n + 1)
finv = [1] * (n + 1)
for i in range(2, n + 1):
    fact[i] = fact[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod
def comb(x, y):
    if x < y:
        return 0
    return fact[x] * finv[y] % mod * finv[x - y] % mod

ans = comb(n, k)
for i in range(10):
    ans -= comb(len(D[i]), k)
    ans %= mod
print(ans)
0