A - 11/22 String Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 150150

問題文

この問題における 11/22 文字列の定義は C 問題および E 問題と同じです。

文字列 TT が以下の条件を全て満たすとき、TT11/22 文字列 と呼びます。

  • T|T| は奇数である。ここで、T|T|TT の長さを表す。
  • 11 文字目から T+121\frac{|T|+1}{2} - 1 文字目までが 1 である。
  • T+12\frac{|T|+1}{2} 文字目が / である。
  • T+12+1\frac{|T|+1}{2} + 1 文字目から T|T| 文字目までが 2 である。

例えば 11/22, 111/222, / は 11/22 文字列ですが、1122, 1/22, 11/2222, 22/11, //2/2/211 はそうではありません。

1, 2, / からなる長さ NN の文字列 SS が与えられます。SS が 11/22 文字列であるか判定してください。

制約

  • 1N1001 \leq N \leq 100
  • SS1, 2, / からなる長さ NN の文字列

入力

入力は以下の形式で標準入力から与えられる。

NN
SS

出力

SS が 11/22 文字列であれば Yes を、そうでなければ No を出力せよ。


入力例 1Copy

Copy
5
11/22

出力例 1Copy

Copy
Yes

11/22 は問題文の 11/22 文字列の条件を満たします。


入力例 2Copy

Copy
1
/

出力例 2Copy

Copy
Yes

/ は問題文の 11/22 文字列の条件を満たします。


入力例 3Copy

Copy
4
1/22

出力例 3Copy

Copy
No

1/22 は問題文の 11/22 文字列の条件を満たしません。


入力例 4Copy

Copy
5
22/11

出力例 4Copy

Copy
No

Score : 150150 points

Problem Statement

The definition of an 11/22 string in this problem is the same as in Problems C and E.

A string TT is called an 11/22 string when it satisfies all of the following conditions:

  • T|T| is odd. Here, T|T| denotes the length of TT.
  • The 11-st through (T+121)(\frac{|T|+1}{2} - 1)-th characters are all 1.
  • The (T+12)(\frac{|T|+1}{2})-th character is /.
  • The (T+12+1)(\frac{|T|+1}{2} + 1)-th through T|T|-th characters are all 2.

For example, 11/22, 111/222, and / are 11/22 strings, but 1122, 1/22, 11/2222, 22/11, and //2/2/211 are not.

Given a string SS of length NN consisting of 1, 2, and /, determine whether SS is an 11/22 string.

Constraints

  • 1N1001 \leq N \leq 100
  • SS is a string of length NN consisting of 1, 2, and /.

Input

The input is given from Standard Input in the following format:

NN
SS

Output

If SS is an 11/22 string, print Yes; otherwise, print No.


Sample Input 1Copy

Copy
5
11/22

Sample Output 1Copy

Copy
Yes

11/22 satisfies the conditions for an 11/22 string in the problem statement.


Sample Input 2Copy

Copy
1
/

Sample Output 2Copy

Copy
Yes

/ satisfies the conditions for an 11/22 string.


Sample Input 3Copy

Copy
4
1/22

Sample Output 3Copy

Copy
No

1/22 does not satisfy the conditions for an 11/22 string.


Sample Input 4Copy

Copy
5
22/11

Sample Output 4Copy

Copy
No


2025-04-25 (Fri)
02:20:18 +00:00