{"raw_statement":[{"iden":"statement","content":"You're given a row with $n$ chairs. We call a seating of people \"maximal\" if the two following conditions hold:\n\n1.  There are no neighbors adjacent to anyone seated.\n2.  It's impossible to seat one more person without violating the first rule.\n\nThe seating is given as a string consisting of zeros and ones ($0$ means that the corresponding seat is empty, $1$ — occupied). The goal is to determine whether this seating is \"maximal\".\n\nNote that the first and last seats are **not** adjacent (if $n \\ne 2$)."},{"iden":"input","content":"The first line contains a single integer $n$ ($1 \\leq n \\leq 1000$) — the number of chairs.\n\nThe next line contains a string of $n$ characters, each of them is either zero or one, describing the seating."},{"iden":"output","content":"Output \"_Yes_\" (without quotation marks) if the seating is \"maximal\". Otherwise print \"_No_\".\n\nYou are allowed to print letters in whatever case you'd like (uppercase or lowercase)."},{"iden":"examples","content":"Input\n\n3\n101\n\nOutput\n\nYes\n\nInput\n\n4\n1011\n\nOutput\n\nNo\n\nInput\n\n5\n10001\n\nOutput\n\nNo"},{"iden":"note","content":"In sample case one the given seating is maximal.\n\nIn sample case two the person at chair three has a neighbour to the right.\n\nIn sample case three it is possible to seat yet another person into chair three."}],"translated_statement":[{"iden":"statement","content":"你面前有一排 n 把椅子。我们称一种坐人方式为“最大”的，如果满足以下两个条件：\n\n坐人方式由一个由 0 和 1 组成的字符串表示（0 表示对应座位为空，1 表示被占用）。你的目标是判断这种坐人方式是否为“最大”的。\n\n注意：第一把和最后一把椅子 *不* 相邻（当 n != 2 时）。\n\n第一行包含一个整数 n（1 lt.eq n lt.eq 1000）— 椅子的数量。\n\n第二行包含一个长度为 n 的字符串，每个字符为 0 或 1，描述坐人情况。\n\n如果坐人方式是“最大”的，请输出 \"_Yes_\"（不带引号）；否则输出 \"_No_\"。\n\n你可以任意使用大写或小写字母输出。\n\n在第一个样例中，给定的坐人方式是最大的。\n\n在第二个样例中，第三把椅子上的人右边有一个邻居。\n\n在第三个样例中，可以在第三把椅子上再安排一个人。"},{"iden":"input","content":"第一行包含一个整数 n（1 lt.eq n lt.eq 1000）— 椅子的数量。第二行包含一个长度为 n 的字符串，每个字符为 0 或 1，描述坐人情况。"},{"iden":"output","content":"如果坐人方式是“最大”的，请输出 \"_Yes_\"（不带引号）；否则输出 \"_No_\"。你可以任意使用大写或小写字母输出。"},{"iden":"examples","content":"输入3101输出Yes输入41011输出No输入510001输出No"},{"iden":"note","content":"在第一个样例中，给定的坐人方式是最大的。在第二个样例中，第三把椅子上的人右边有一个邻居。在第三个样例中，可以在第三把椅子上再安排一个人。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of chairs.  \nLet $ s \\in \\{0,1\\}^n $ be a binary string representing the seating, where $ s_i = 1 $ means chair $ i $ is occupied, and $ s_i = 0 $ means it is empty, for $ i \\in \\{1, \\dots, n\\} $.\n\n**Constraints**  \n$ 1 \\le n \\le 1000 $\n\n**Objective**  \nDetermine whether $ s $ is *maximal*, i.e., the following two conditions hold:  \n1. **No two adjacent seats are both occupied**:  \n   $$\n   \\forall i \\in \\{1, \\dots, n-1\\}, \\quad s_i = 1 \\implies s_{i+1} = 0\n   $$  \n2. **No empty seat can be occupied without violating condition 1** (i.e., every empty seat has at least one adjacent occupied seat):  \n   $$\n   \\forall i \\in \\{1, \\dots, n\\}, \\quad s_i = 0 \\implies \\exists j \\in \\{i-1, i+1\\} \\cap \\{1, \\dots, n\\} \\text{ such that } s_j = 1\n   $$  \n\nOutput \"Yes\" if both conditions hold; otherwise, output \"No\".","simple_statement":null,"has_page_source":false}