QOJ.ac

QOJ

Süre Sınırı: 7 s Bellek Sınırı: 512 MB Toplam puan: 100

#18793. 数列与查询35

İstatistikler

输入格式

第一行包含一个整数 $N$,表示序列的长度。($1 \le N \le 120{,}000$)

第二行包含 $N$ 个整数 $A_1, A_2, \ldots, A_N$,所有数互不相同。($1 \le A_i \le N$)

第三行包含一个整数 $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$)

输出格式

对于每个查询,输出一行结果,即 YESNO

样例

输入 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.