QOJ.ac

QOJ

시간 제한: 2 s 메모리 제한: 1024 MB 총점: 100

#18800. 수열과 쿼리 42

통계

長さ $N$ の数列 $A_1, A_2, \ldots, A_N$ が与えられる。数列の各要素は $1$ から $N$ までの相異なる整数である。以下のクエリを処理するプログラムを書け:

  • l r: $(A_l, A_{l+1}, \ldots, A_r)$ の最長増加部分列 (LIS) の長さを出力せよ。

入力

1行目には数列の長さ $N$ とクエリの個数 $Q$ が与えられる。

続く $Q$ 行には、それぞれ上記の形式のクエリが与えられる。

出力

各クエリに対して、答えを別の行に出力せよ。

入出力例

入力 1

9 10
6 9 4 2 1 5 7 8 3
1 9
2 8
3 7
4 6
5 5
1 5
2 6
3 7
4 8
5 9

出力 1

4
4
3
2
1
2
2
3
4
4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.