QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#23887. บิทาโร่กับ IOI

Statistics

โจทย์ปัญหา

กำหนดสตริง $S$ ที่มีความยาว $N$ อักขระแต่ละตัวของ $S$ คือตัวใดตัวหนึ่งระหว่าง B, I, T, A, R หรือ O

จงตรวจสอบว่ามี IOI ปรากฏเป็นลำดับย่อย (ซึ่งไม่จำเป็นต้องติดกัน) ของสตริง $S$ หรือไม่ กล่าวคือ จงตรวจสอบว่ามีกลุ่มของจำนวนเต็ม $3$ จำนวน $(i, j, k)$ ที่สอดคล้องกับเงื่อนไขต่อไปนี้หรือไม่:

  • $1 \le i < j < k \le N$
  • อักขระตัวที่ $i$ ของ $S$ คือ I
  • อักขระตัวที่ $j$ ของ $S$ คือ O
  • อักขระตัวที่ $k$ ของ $S$ คือ I

ข้อจำกัด

  • $1 \le N \le 100$
  • $S$ เป็นสตริงที่มีความยาว $N$
  • อักขระแต่ละตัวของ $S$ คือตัวใดตัวหนึ่งระหว่าง B, I, T, A, R หรือ O

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

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

N
S

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

หากมี IOI ในลำดับย่อยของสตริง $S$ ให้แสดงผล Yes มิฉะนั้นให้แสดงผล No

ตัวอย่างข้อมูลนำเข้าและส่งออก

ข้อมูลนำเข้าตัวอย่าง 1

8
BITAROOI

ข้อมูลส่งออกตัวอย่าง 1

Yes
  • กลุ่มของจำนวนเต็ม $3$ จำนวน $(2, 6, 8)$ และ $(2, 7, 8)$ สอดคล้องกับเงื่อนไขของ $(i, j, k)$ ในโจทย์ปัญหา กล่าวคือ มี IOI ในลำดับย่อยของสตริง $S$ จึงแสดงผล Yes

ข้อมูลนำเข้าตัวอย่าง 2

6
BBOOII

ข้อมูลส่งออกตัวอย่าง 2

No
  • ไม่มี IOI ในลำดับย่อยของสตริง $S$ จึงแสดงผล No

ข้อมูลนำเข้าตัวอย่าง 3

5
IOIOI

ข้อมูลส่งออกตัวอย่าง 3

Yes

ข้อมูลนำเข้าตัวอย่าง 4

9
RATRATRAT

ข้อมูลส่งออกตัวอย่าง 4

No

ข้อมูลนำเข้าตัวอย่าง 5

1
A

ข้อมูลส่งออกตัวอย่าง 5

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.