QOJ.ac

QOJ

시간 제한: 7 s 메모리 제한: 512 MB 총점: 100

#18793. Dãy số và Truy vấn 35

통계

Dữ liệu vào

Dòng đầu tiên chứa một số nguyên $N$, độ dài của dãy. ($1 \le N \le 120{,}000$)

Dòng thứ hai chứa $N$ số nguyên $A_1, A_2, \ldots, A_N$, tất cả đều phân biệt. ($1 \le A_i \le N$)

Dòng thứ ba chứa một số nguyên $M$, số lượng truy vấn. ($1 \le M \le 120{,}000$)

$M$ dòng tiếp theo, mỗi dòng chứa một truy vấn có dạng $l$ $r$ $k$. ($1 \le L \le R \le N$, $0 \le K \le R-L+1$)

Dữ liệu ra

Với mỗi truy vấn, in ra một dòng duy nhất chứa YES hoặc NO.

Ví dụ

Đầu vào 1

6
2 5 6 1 3 4
1
1 6 5

Đầu ra 1

YES

Đầu vào 2

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

Đầu ra 2

YES
YES
YES
YES

Đầu vào 3

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

Đầu ra 3

NO
YES

Đầu vào 4

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

Đầu ra 4

NO
NO
YES

Cho một dãy $A_1, A_2, \ldots, A_N$ có độ dài $N$. Tất cả các số trong dãy đều là các số nguyên từ $1$ đến $N$ và đôi một phân biệt. Hãy viết một chương trình xử lý các truy vấn sau:

  • l r k: xoay phải đoạn con $[A_l, A_{l+1}, \ldots, A_r]$ đi $k$ vị trí. Nghĩa là, $A_l$ trở thành $A_{l+k}$, $A_{r-k}$ trở thành $A_r$, $A_{r-k+1}$ trở thành $A_l$, và $A_r$ trở thành $A_{l+k-1}$. Sau đó, xác định xem toàn bộ dãy có chứa một dãy con tăng dần có độ dài $3$ (dãy con, không nhất thiết liên tiếp) hay không. Nếu có, in ra YES; nếu không, in ra 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.