Universal Cup Judging System

Universal Cup

Time Limit: 3.5 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

סדרה מסוג 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.