Empty Quartz
Time limit2sMemory limit1024 MB
Count the 0/1 strings of length N where exactly K intervals contain an odd number of 1s, modulo 998244353, for T queries.
- Level
Medium5 of 10
- Topics
- Combinatorics, Prefix sum, Math
- Solved
- No attempts yet
Problem
crystals are aligned in a row. Some of them may be phantoms.
Jun counted the real crystals in every interval with and recorded whether each count was even or odd.
His records show that there were intervals containing an odd number of real crystals. How many possible crystal alignments are there? Output the answer modulo .
If the -th crystal from the left is real in one alignment and a phantom in the other, the two alignments are considered different.
You are given problems. Answer each of them.
Input
The first line contains . Each of the next lines contains and .
Output
Output lines. On line , print the answer for and .
Hint
Write a real crystal as 1 and a phantom as 0. For and , the valid alignments are the following three.
- 0, 1, 0
- 1, 0, 1
- 1, 1, 1