結果
問題 |
No.1189 Sum is XOR
|
ユーザー |
![]() |
提出日時 | 2022-01-06 11:35:03 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 628 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 119,604 KB |
最終ジャッジ日時 | 2024-11-07 02:51:01 |
合計ジャッジ時間 | 4,448 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | RE * 3 TLE * 1 -- * 17 |
ソースコード
n, k = map(int, input().split()) A = list(map(int, input().split())) mod = 998244353 from collections import defaultdict dp = [defaultdict(lambda: 0) for i in range(k+1)] dp[0][0] = 1 for i, a in enumerate(A): for j in range(i+1): for s, v in dp[j].items(): if j+1 <= k and s^a == s+a: dp[j+1][s^a] +=v dp[j+1][s^a] %= mod ans = 0 for s, v in dp[k].items(): ans += v ans %= mod print(ans)