結果

問題 No.1189 Sum is XOR
ユーザー marroncastlemarroncastle
提出日時 2020-08-22 17:11:58
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 557 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 104,968 KB
最終ジャッジ日時 2024-04-23 11:15:46
合計ジャッジ時間 6,752 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
103,476 KB
testcase_01 AC 240 ms
103,732 KB
testcase_02 AC 238 ms
103,516 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 207 ms
70,528 KB
testcase_12 AC 242 ms
103,424 KB
testcase_13 AC 228 ms
98,104 KB
testcase_14 AC 215 ms
85,240 KB
testcase_15 AC 206 ms
70,528 KB
testcase_16 AC 201 ms
67,328 KB
testcase_17 AC 206 ms
70,144 KB
testcase_18 AC 211 ms
77,184 KB
testcase_19 AC 230 ms
91,136 KB
testcase_20 AC 221 ms
91,524 KB
testcase_21 AC 49 ms
58,624 KB
testcase_22 AC 49 ms
58,880 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