QOJ.ac

QOJ

Time Limit: 7 s Memory Limit: 512 MB Total points: 100

#18793. 数列とクエリ 35

Statistics

入力

最初の行には整数 $N$ が与えられる。これは数列の長さである。($1 \le N \le 120{,}000$)

2 行目には $N$ 個の整数 $A_1, A_2, \ldots, A_N$ が与えられる。これらの値はすべて異なる。($1 \le A_i \le N$)

3 行目には整数 $M$ が与えられる。これはクエリの個数である。($1 \le M \le 120{,}000$)

続く $M$ 行にはそれぞれクエリが $l$ $r$ $k$ の形式で与えられる。($1 \le L \le R \le N$, $0 \le K \le R-L+1$)

出力

各クエリごとに、YES または NO を 1 行に出力せよ。

入出力例

入力 1

6
2 5 6 1 3 4
1
1 6 5

出力 1

YES

入力 2

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

出力 2

YES
YES
YES
YES

入力 3

5
4 3 2 5 1
2
3 4 1
1 2 1

出力 3

NO
YES

入力 4

6
6 5 4 3 2 1
3
1 1 0
1 3 1
2 5 3

出力 4

NO
NO
YES

長さ $N$ の数列 $A_1, A_2, \ldots, A_N$ が与えられる。数列内の数はすべて $1$ 以上 $N$ 以下の整数であり、すべて異なる。以下のクエリを処理するプログラムを作成せよ。

  • l r k: 部分配列 $[A_l, A_{l+1}, \ldots, A_r]$ を右方向に $k$ 位置だけ回転させる。すなわち、$A_l$ は $A_{l+k}$ になり、$A_{r-k}$ は $A_r$ になり、$A_{r-k+1}$ は $A_l$ になり、$A_r$ は $A_{l+k-1}$ になる。その後、数列全体に長さ $3$ の増加部分列(連続しなくてもよい)が存在するかどうかを判定する。存在する場合は YES を、存在しない場合は NO を出力せよ。

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.