結果

問題 No.1189 Sum is XOR
ユーザー ayaoniayaoni
提出日時 2020-12-11 10:34:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 1,005 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 102,100 KB
最終ジャッジ日時 2023-10-20 01:25:16
合計ジャッジ時間 2,663 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
102,100 KB
testcase_01 AC 84 ms
102,056 KB
testcase_02 AC 84 ms
102,048 KB
testcase_03 AC 55 ms
78,804 KB
testcase_04 AC 53 ms
74,976 KB
testcase_05 AC 62 ms
87,468 KB
testcase_06 AC 77 ms
98,996 KB
testcase_07 AC 58 ms
80,800 KB
testcase_08 AC 46 ms
68,180 KB
testcase_09 AC 46 ms
68,944 KB
testcase_10 AC 43 ms
66,776 KB
testcase_11 AC 55 ms
70,164 KB
testcase_12 AC 84 ms
101,828 KB
testcase_13 AC 81 ms
98,024 KB
testcase_14 AC 69 ms
85,500 KB
testcase_15 AC 58 ms
70,176 KB
testcase_16 AC 55 ms
67,376 KB
testcase_17 AC 56 ms
69,536 KB
testcase_18 AC 61 ms
76,948 KB
testcase_19 AC 75 ms
90,276 KB
testcase_20 AC 78 ms
90,324 KB
testcase_21 AC 46 ms
61,956 KB
testcase_22 AC 46 ms
61,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,K = MI()
A = LI()
mod = 998244353

if K >= 11:
    print(0)
    exit()

count = [0]*1024
for a in A:
    count[a] += 1

dp = [[0]*1024 for _ in range(K+1)]
# dp[i][j] = 和集合がjに含まれるような、i個の数字の選び方

for j in range(1024):
    dp[0][j] = 1

for i in range(1,K+1):
    for j in range(1,1024):
        k = j
        while k:
            dp[i][j] += dp[i-1][j^k]*count[k]
            dp[i][j] %= mod
            k = (k-1) & j

x = 1
for i in range(2,K+1):
    x *= i

ans = dp[-1][-1]*pow(x,mod-2,mod)
print(ans % mod)
0