結果

問題 No.1189 Sum is XOR
ユーザー marroncastlemarroncastle
提出日時 2020-08-22 17:19:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 103,444 KB
最終ジャッジ日時 2024-04-23 11:17:55
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
103,444 KB
testcase_01 AC 215 ms
103,168 KB
testcase_02 AC 206 ms
103,424 KB
testcase_03 AC 52 ms
77,312 KB
testcase_04 AC 48 ms
75,008 KB
testcase_05 AC 57 ms
85,888 KB
testcase_06 AC 69 ms
98,048 KB
testcase_07 AC 54 ms
80,000 KB
testcase_08 AC 43 ms
66,560 KB
testcase_09 AC 43 ms
67,328 KB
testcase_10 AC 40 ms
64,896 KB
testcase_11 AC 179 ms
71,168 KB
testcase_12 AC 206 ms
103,424 KB
testcase_13 AC 207 ms
98,304 KB
testcase_14 AC 198 ms
84,992 KB
testcase_15 AC 181 ms
70,784 KB
testcase_16 AC 178 ms
67,840 KB
testcase_17 AC 179 ms
69,760 KB
testcase_18 AC 181 ms
77,312 KB
testcase_19 AC 194 ms
91,776 KB
testcase_20 AC 196 ms
91,648 KB
testcase_21 AC 39 ms
59,392 KB
testcase_22 AC 38 ms
58,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N, K = map(int, input().split())
  A = list(map(int, input().split()))
  if K>10:
    return 0
  mod = 998244353
  lis = [0]*(1<<10)
  for a in A:
    lis[a] += 1
  dp = [[0]*(1<<10) for _ in range(11)]
  dp[0][0] = 1
  for i in range(1,1<<10):
    if lis[i]==0:
      continue
    for p in range(10):
      for j in range(1<<10):
        if i+j!=i^j:
          continue
        dp[p+1][i+j] += dp[p][j]*lis[i]
        dp[p+1][i+j] %= mod
  return sum(dp[K])%mod
print(solve())
0