Row

TimeLimit:1000MS  MemoryLimit:256MB
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description

You're given a row with  chairs. We call a seating of people "maximal" if the two following conditions hold:

  1. There are no neighbors adjacent to anyone seated.

  2. It's impossible to seat one more person without violating the first rule.

The seating is given as a string consisting of zeros and ones ( means that the corresponding seat is empty,  — occupied). The goal is to determine whether this seating is "maximal".

Note that the first and last seats are not adjacent (if ).

Input

The first line contains a single integer n (  ) — the number of chairs.

The next line contains a string of  characters, each of them is either zero or one, describing the seating.


Output

Output "Yes" (without quotation marks) if the seating is "maximal". Otherwise print "No".

You are allowed to print letters in whatever case you'd like (uppercase or lowercase).


SampleInput 1
3
101
SampleOutput 1
Yes
SampleInput 2
4
1011
SampleOutput 2
No
SampleInput 3
5
10001
SampleOutput 3
No
Note

In sample case one the given seating is maximal.

In sample case two the person at chair three has a neighbour to the right.

In sample case three it is possible to seat yet another person into chair three.

Submit
题目统计信息详细
总AC数1
通过人数1
尝试人数1
总提交量1
AC率100.00%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: