#P2075. 区间 LIS
区间 LIS
Description
Given a permutation of , there are queries. Each query asks for the length of the longest increasing subsequence within the interval .
Input Format
The first line contains two positive integers . The second line contains positive integers, representing the permutation . Then lines follow, each containing two positive integers , representing a query.
Output Format
For each query, output the corresponding answer.
5 3
1 5 3 4 2
1 5
1 3
3 5
3
2
2
10 10
4 8 1 10 7 5 2 6 3 9
1 10
1 4
1 5
5 10
3 9
3 10
3 10
5 8
4 5
1 2
4
3
3
3
3
4
4
2
1
2
Hint
| Subtask ID | Score | ||
|---|---|---|---|
For all testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号