F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Increasing Subsequence

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 359    Accepted Submission(s): 153


Problem Description
In a sequence of integers $a_1, a_2, \ldots, a_n$, if an increasing subsequence is not a subsequence of other increasing subsequences, we call it maximal. A subsequence is a sequence we can get by erasing some (possibly zero) elements from the original sequence.

Finding or counting the longest increasing subsequence is a classic problem. Now Yukikaze wants you to count the number of maximal increasing subsequences in some permutations modulo $998244353$. A permutation of length $n$ is a sequence of numbers such that every number from $1$ to $n$ appears exactly once.
 

Input
The first line of the input contains a single integer $T$ $(1 \leq T \leq 10^4)$, denoting the number of test cases.

The first line of each test case contains a single integer $n$ $(1 \leq n \leq 10^5)$, denoting the length of the permutation.

The second line of each testcase contains $n$ integers $a_1, a_2, \ldots, a_n$ $(1 \le a_i \le n)$, denoting the permutation. It's guaranteed that every number from $1$ to $n$ appears exactly once.

The sum of $n$ in all test case will not exceed $2 \times 10^5$.
 

Output
For each test case, output a single integer denoting the number of the maximal increasing subsequences in the given permutation modulo $998244353$.
 

Sample Input
2 4 2 1 4 3 5 1 5 2 4 3
 

Sample Output
4 3
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-12 11:12:03, Gzip enabled