QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB Toplam puan: 100

#23887. 比太郎與 IOI

İstatistikler

題目描述

俾定一個長度為 $N$ 嘅字串 $S$。$S$ 嘅每個字元都係 B、I、T、A、R、O 之中嘅一個。

請判斷字串 $S$ 嘅(唔一定連續嘅)子序列入面存唔存在 IOI。即係話,請判斷存唔存在滿足以下條件嘅 $3$ 個整數嘅組合 $(i, j, k)$:

  • $1 \le i < j < k \le N$。
  • $S$ 嘅第 $i$ 個字元係 I。
  • $S$ 嘅第 $j$ 個字元係 O。
  • $S$ 嘅第 $k$ 個字元係 I。

數據範圍

  • $1 \le N \le 100$。
  • $S$ 係長度為 $N$ 嘅字串。
  • $S$ 嘅每個字元都係 B、I、T、A、R、O 之中嘅一個。

輸入格式

輸入透過標準輸入以以下格式俾出:

N
S

輸出格式

如果字串 $S$ 嘅子序列入面存在 IOI 就輸出 Yes,否則輸出 No。

輸入輸出範例

輸入範例 1

8
BITAROOI

輸出範例 1

Yes
  • $3$ 個整數嘅組合 $(2, 6, 8)$ 同 $(2, 7, 8)$ 滿足題目描述入面對於 $(i, j, k)$ 嘅條件。即係話,字串 $S$ 嘅子序列入面存在 IOI,所以輸出 Yes。

輸入範例 2

6
BBOOII

輸出範例 2

No
  • 字串 $S$ 嘅子序列入面唔存在 IOI,所以輸出 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.