#P3970. [TJOI2014] 上升子序列
[TJOI2014] 上升子序列
Description
Given a sequence containing only integers (the absolute value of each element does not exceed ), you need to count the number of increasing subsequences, where an increasing subsequence satisfies the following conditions:
- It is a subsequence of the original sequence.
- Its length is at least .
- All elements are strictly increasing.
If two increasing subsequences are identical, count them only once. For example, the sequence has increasing subsequences: , , , .
Input Format
The first line contains an integer , the length of the sequence. The next line contains integers, the sequence elements.
Output Format
Output a single line: the number of increasing subsequences of the original sequence. Since the answer can be very large, output the remainder modulo .
4
1 2 3 3
4
Hint
Constraints
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号