Odd Xor Subsequences
Practice
4.3 (3 votes)
Fourier transformations
Linear algebra
Math
Mathematics
Bit manipulation
Fast fourier transform
Combinatorics
Problem
90% Success 966 Attempts 50 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Problem:
You are given a sequence \(A\) of size \(N\) and \(Q\) queries. For each query:
- You are given an integer \(K\).
- Your task is to count the number of subsequences of \(A\) of size \(K\) such that Bitwise Xor Sum of elements of the subsequence is odd. Since the answer can be large, compute it modulo \(998, 244, 353\).
Note: Bitwise Xor Sum of a sequence is Bitwise XOR of its elements.
Input Format:
- The first line of the input contains a single integer \(N\).
- The second line of the input contains \(N\) space-separated integers \(A_1, A_2, ..., A_N\).
- The third line of the input contains a single integer \(Q\).
- \(Q\) lines follow. Each of these lines contains a single integer \(K\) describing a query.
Output Format:
- For each query, print a single line containing one integer ― the count of subsequences of \(A\) of size \(K\) having odd Bitwise Xor Sum modulo \(998, 244, 353\).
Constraints:
- \(1 \leq N \leq 10^5\)
- \(0 \leq A_i \lt 2^{30}\)
- \(1 \leq Q \leq 10^5\)
- \(1 \leq K \leq N\)
Submissions
Please login to view your submissions
Similar Problems
Points:50
Tags:
Linear AlgebrafftFast Fourier transformHardMathematics
Points:50
2 votes
Tags:
ImplementationLinear AlgebraFast Fourier transformC++Fourier TransformationsOptimizationMath
Points:50
2 votes
Tags:
MathematicsHardFast Fourier transformLinear Algebra
Editorial