{"problem":{"name":"A. Row","description":{"content":"You're given a row with $n$ 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 m","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF982A"},"statements":[{"statement_type":"Markdown","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$).\n\n## Input\n\nThe 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.\n\n## Output\n\nOutput \"_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).\n\n[samples]\n\n## Note\n\nIn 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.","is_translate":false,"language":"English"},{"statement_type":"Markdown","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在第三个样例中，可以在第三把椅子上再安排一个人。\n\n## Input\n\n第一行包含一个整数 n（1 lt.eq n lt.eq 1000）— 椅子的数量。第二行包含一个长度为 n 的字符串，每个字符为 0 或 1，描述坐人情况。\n\n## Output\n\n如果坐人方式是“最大”的，请输出 \"_Yes_\"（不带引号）；否则输出 \"_No_\"。你可以任意使用大写或小写字母输出。\n\n[samples]\n\n## Note\n\n在第一个样例中，给定的坐人方式是最大的。在第二个样例中，第三把椅子上的人右边有一个邻居。在第三个样例中，可以在第三把椅子上再安排一个人。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**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\".","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF982A","tags":["brute force","constructive algorithms"],"sample_group":[["3\n101","Yes"],["4\n1011","No"],["5\n10001","No"]],"created_at":"2026-03-03 11:00:39"}}