結果

問題 No.1189 Sum is XOR
ユーザー tikitaka1201tikitaka1201
提出日時 2020-09-24 19:30:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,660 KB
実行使用メモリ 106,160 KB
最終ジャッジ日時 2023-09-10 13:49:02
合計ジャッジ時間 5,644 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
106,136 KB
testcase_01 AC 163 ms
106,056 KB
testcase_02 AC 161 ms
106,160 KB
testcase_03 AC 89 ms
88,664 KB
testcase_04 AC 87 ms
86,876 KB
testcase_05 AC 96 ms
95,272 KB
testcase_06 AC 106 ms
104,716 KB
testcase_07 AC 91 ms
90,492 KB
testcase_08 AC 79 ms
79,784 KB
testcase_09 AC 79 ms
80,552 KB
testcase_10 AC 79 ms
78,552 KB
testcase_11 AC 134 ms
81,328 KB
testcase_12 AC 158 ms
106,160 KB
testcase_13 AC 165 ms
103,084 KB
testcase_14 AC 154 ms
91,728 KB
testcase_15 AC 147 ms
81,588 KB
testcase_16 AC 146 ms
78,492 KB
testcase_17 AC 133 ms
80,212 KB
testcase_18 AC 135 ms
84,908 KB
testcase_19 AC 164 ms
96,360 KB
testcase_20 AC 174 ms
95,984 KB
testcase_21 AC 113 ms
77,452 KB
testcase_22 AC 116 ms
77,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if(k > 10):
    print(0)
    exit()
from collections import Counter
cnt=Counter(a)

dp=[[0] * (2**10) for _ in range(k+1)]
dp[0][0]=1

for x in range(2**10):
    for i in range(k):
        for y in range(2**10):        
            if(x&y)==0:
                dp[i+1][x|y] += dp[i][y] * cnt[x]
                dp[i+1][x|y] %= mod

ans = sum(dp[-1])%mod
print(ans)
0