結果

問題 No.1189 Sum is XOR
ユーザー marroncastlemarroncastle
提出日時 2020-08-22 17:11:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 557 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,732 KB
最終ジャッジ日時 2024-04-23 11:15:39
合計ジャッジ時間 29,475 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,306 ms
28,600 KB
testcase_01 AC 1,304 ms
28,596 KB
testcase_02 AC 1,334 ms
28,600 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 1,253 ms
14,080 KB
testcase_12 AC 1,304 ms
28,384 KB
testcase_13 AC 1,293 ms
25,624 KB
testcase_14 AC 1,274 ms
20,184 KB
testcase_15 AC 1,248 ms
14,336 KB
testcase_16 AC 1,241 ms
12,672 KB
testcase_17 AC 1,248 ms
14,080 KB
testcase_18 AC 1,256 ms
16,700 KB
testcase_19 AC 1,285 ms
23,284 KB
testcase_20 AC 1,285 ms
23,412 KB
testcase_21 AC 36 ms
10,752 KB
testcase_22 AC 34 ms
10,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()))
  mod = 998244353
  lis = [0]*(1<<10)
  for i in range(N):
    lis[A[i]] += 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