#P15713. [JAG 2023 Summer Camp #2] Empty Quartz

[JAG 2023 Summer Camp #2] Empty Quartz

题目描述

NN crystals are aligned in a row. However, some of them may be phantoms.

Jun counted the number of real crystals from ll-th to rr-th (closed interval) for every l,r(1lrN)l, r (1 \leq l \leq r \leq N) pair and recorded their evenness.

His N(N+1)2\frac{N(N+1)}{2} records show that there were KK intervals that contained an odd number of real crystals. How many possible crystal alignments are there? Answer the remainder divided by 998244353998244353.

Note that if there is ii such that the ii-th crystal from the left is real on one side and phantom on the other, the two alignments are considered different.

You are given TT of the above problems. Answer each of them.

输入格式

$$\begin{aligned} &T \\ &N_1 \ K_1 \\ &\vdots \\ &N_T \ K_T \end{aligned} $$

The input satisfies the following constraints.

  • All inputs consist of integers.
  • 1T1051 \leq T \leq 10^5
  • 1Ni1051 \leq N_i \leq 10^5
  • 0KiNi(Ni+1)20 \leq K_i \leq \frac{N_i(N_i+1)}{2}

输出格式

Output TT lines. On the line ii, answer the problem when N=Ni,K=KiN = N_i, K = K_i. Add a new line at the end of each line.

1
3 4
3
5
5 9
6 10
10 24
10 25
100000 75915540
10
21
165
0
651081880

提示

If we denote a real crystal as 11 and an phantom as 00, the following three alignments satisfy the condition at Sample Input 1.

  • 0,1,00, 1, 0
  • 1,0,11, 0, 1
  • 1,1,11, 1, 1