Universal Cup Judging System

Universal Cup

حد الوقت: 3.5 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓
الإحصائيات

ลำดับประเภท rururutata ถูกนิยามว่าเป็นลำดับที่สามารถเขียนในรูป $r + r + r + t + t$ ($+$ หมายถึงการนำมาต่อกัน) โดยใช้ลำดับที่ไม่ว่าง $r$ และ $t$

คุณได้รับลำดับของจำนวนเต็ม $S = (S_1, S_2, \dots, S_N)$ ที่มีความยาว $N$ มีคำถาม $Q$ ข้อซึ่งคุณต้องประมวลผลตามลำดับ

ในแต่ละคำถาม จะกำหนดจำนวนเต็ม $L$ และ $R$ มาให้ จงพิจารณาว่ามีลำดับประเภท rururutata ที่เป็นอาร์เรย์ย่อยติดกันของ $(S_L, S_{L+1}, \dots, S_R)$ หรือไม่

ข้อมูลนำเข้า

ข้อมูลนำเข้าจะถูกกำหนดให้ในรูปแบบต่อไปนี้:

N
S1 S2 ... SN
Q
query1
query2
:
queryQ

แต่ละคำถามจะถูกกำหนดให้ในรูปแบบต่อไปนี้:

L R

ข้อจำกัด

  • $1 \le N \le 5 \times 10^5$
  • $1 \le S_i \le N$ ($1 \le i \le N$)
  • $1 \le Q \le 5 \times 10^5$
  • $1 \le L \le R \le N$
  • ค่าข้อมูลนำเข้าทั้งหมดเป็นจำนวนเต็ม

ข้อมูลส่งออก

พิมพ์ $Q$ บรรทัด

ในบรรทัดที่ $i$ ให้พิมพ์ Yes หากมีลำดับประเภท rururutata สำหรับคำถามข้อที่ $i$ และพิมพ์ No ในกรณีอื่นๆ

ตัวอย่าง

ข้อมูลนำเข้า 1

17
3 3 3 2 2 2 4 3 4 3 4 3 2 2 2 2 2
5
1 5
4 12
2 6
8 15
13 17

ข้อมูลส่งออก 1

Yes
Yes
No
No
Yes

หมายเหตุ

สำหรับคำถามข้อแรก $(S_1, S_2, S_3, S_4, S_5) = (3, 3, 3, 2, 2)$ เป็นลำดับประเภท rururutata เงื่อนไขเป็นจริงโดยการเลือก $r = (3)$ และ $t = (2)$

สำหรับคำถามข้อที่สอง ใน $(S_4, S_5, \dots, S_{12})$ อาร์เรย์ย่อยติดกัน $(S_4, S_5, \dots, S_{10}) = (2, 2, 2, 4, 3, 4, 3)$ เป็นลำดับประเภท rururutata เงื่อนไขเป็นจริงโดยการเลือก $r = (2)$ และ $t = (4, 3)$

สำหรับคำถามข้อที่สาม $(3, 3, 2, 2, 2)$ ไม่ใช่ลำดับประเภท rururutata และเห็นได้ชัดว่าไม่มีลำดับประเภท rururutata ที่สั้นกว่าอยู่ภายในด้วย

สำหรับคำถามข้อที่สี่ โปรดสังเกตว่า $(3, 3, 3, 2, 2)$ ไม่ใช่อาร์เรย์ย่อยติดกัน

สำหรับคำถามข้อที่ห้า โปรดสังเกตว่าอนุญาตให้ $r$ และ $t$ เหมือนกันได้

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1487EditorialOpen题解jianglyView
#1345EditorialOpen题解MilmonView

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.