| The 2026 CCPC Online Contest |
|---|
| Закончено |
You are given an integer sequence $$$a_1, a_2, \ldots, a_n$$$ of length $$$n$$$, and an integer $$$x$$$.
Define a subsequence of the sequence as follows: for any non-empty set of indices $$$\{i_1,i_2,\cdots,i_m\}\ (i_1 \lt i_2 \lt \cdots \lt i_m)$$$ chosen from $$$1,\ldots,n$$$, taking $$$a_{i_1},\ldots,a_{i_m}$$$ in their original order is a subsequence. Define its median as follows: sort the $$$m$$$ chosen values into $$$v_1\le v_2\le\cdots\le v_m$$$, then:
Find the number of subsequences whose median is exactly $$$x$$$. Since this number can be very large, output it modulo $$$998244353$$$.
Note: even if two different index sets happen to pick out the exact same multiset of values (possible since the sequence may contain repeated numbers), they are still counted as two distinct subsequences. It is the index set itself, not the multiset of chosen values, that distinguishes subsequences. The empty index set is not a subsequence and is never counted.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1\le t\le 10^4$$$).
For each testcase:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\times10^5$$$.
For each test case, output one line with one integer: the number of subsequences whose median is exactly $$$x$$$, modulo $$$998244353$$$.
25 31 3 5 3 22 0-1 1
14 1
| Название |
|---|


