| Kotlin Heroes: Episode 14 |
|---|
| Finished |
Let's call an integer sequence self-produced if for every $$$i$$$ ($$$1 \le i \le n$$$) at least one of the following conditions holds:
Note that $$$0$$$ at the beginning/end of the sequence is also considered valid.
You are given an integer array $$$a$$$ of size $$$n$$$. Your task is to calculate the number of self-produced subsequences of the array $$$a$$$. Since the answer might be large, print it modulo $$$998244353$$$. Two subsequences are different if the indices of chosen elements are different.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^9$$$).
Additional constraint on the input: the sum of $$$n$$$ over all test cases doesn't exceed $$$2 \cdot 10^5$$$.
For each test case, print a single integer — the number of self-produced subsequences of the array $$$a$$$ taken modulo $$$998244353$$$.
531 1 220 050 1 0 1 061 0 2 2 1 1112 0 3 1 0 0 2 3 0 3 2
2412841
| Name |
|---|


