結果
問題 |
No.1189 Sum is XOR
|
ユーザー |
|
提出日時 | 2020-08-22 15:42:36 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 605 bytes |
コンパイル時間 | 86 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 28,592 KB |
最終ジャッジ日時 | 2024-10-15 09:53:50 |
合計ジャッジ時間 | 12,874 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 13 |
ソースコード
import sys sys.setrecursionlimit(10**6) n, k = map(int, input().split()) a = list(map(int, input().split())) g = [0] * 1024 for x in a: g[x] += 1 def gen(x, n, l): if bin(x).count('1') < n: yield [0] elif n == 0: yield l else: y = x while y: if g[y] > 0: yield from gen(x ^ y, n - 1, l + [y]) y = (y - 1) & x if l and y < l[-1]: break ans = 0 mod = 998244353 for l in gen(1023, k, list()): cur = 1 for x in l: cur = cur * g[x] % mod ans = (ans + cur) % mod print(ans)