5 10101 60 45 30 40 80
4 When Takahashi is given $X=50$, it judges the $2$\-nd, $3$\-rd, and $4$\-th people to be children and the $1$\-st and $5$\-th to be adults. In reality, the $2$\-nd and $4$\-th are children, and the $1$\-st, $3$\-rd, and $5$\-th are adults, so the $1$\-st, $2$\-nd, $4$\-th, and $5$\-th people are correctly judged. Thus, $f(50)=4$. This is the maximum since there is no $X$ that judges correctly for all $5$ people. Thus, $4$ should be printed.
3 000 1 2 3
3 For example, $X=10$ achieves the maximum value $f(10)=3$. Note that the people may be all children or all adults.
5 10101 60 50 50 50 60
4 For example, $X=55$ achieves the maximum value $f(55)=4$. Note that there may be multiple people with the same weight.
{
"problem": {
"name": "Robot Takahashi",
"description": {
"content": "There are $N$ people, each of whom is either a child or an adult. The $i$\\-th person has a weight of $W_i$. Whether each person is a child or an adult is specified by a string $S$ of length $N$ cons",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc257_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ people, each of whom is either a child or an adult. The $i$\\-th person has a weight of $W_i$. \nWhether each person is a child or an adult is specified by a string $S$ of length $N$ cons...",
"is_translate": false,
"language": "English"
}
]
}