結果
| 問題 |
No.1189 Sum is XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 17:19:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 238 ms / 2,000 ms |
| コード長 | 571 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 82,216 KB |
| 実行使用メモリ | 103,552 KB |
| 最終ジャッジ日時 | 2024-10-15 11:13:34 |
| 合計ジャッジ時間 | 4,872 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
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())