P17337 【MX-X30-T3】Universe Decomposition
Description
You have a $01$ sequence $a$ and two operations:
1. Choose $a_i
Input Format
There are multiple test cases in this problem. The first line contains an integer $T$, the number of test cases.
The first line of each test case contains an integer $n$.
The next line contains a $01$ string, where the $i$-th character is $a_i$.
Output Format
There are $T$ lines; the $i$-th line contains an integer: the number of essentially different sequences you can end up with. Take the result modulo $998244353$.
Explanation/Hint
Let $s$ denote the maximum sum of $a_i$ within a single test case. Let $N$ denote the sum of $n$ over all test cases.
| Test point |$N\le $ | $s\le$ |
|:-:|:-:|:-:|
| $1\sim 4$ | $200$ | $200$ |
| $5\sim 10$ | $10^4$ | $10^3$ |
| $11\sim 15$ | $10^5$ | $10^3$|
| $16\sim 20$ | $10^5$ |$2\times 10^3$|
For all data, $1\le T\le 10^3$, $1\le n,N\le 10^5$, $0\le s\le 2\times 10^3$.
Translated by QwenWork