4 (()()) 2 (())() 2 (() 2 (()()())((()()(())())) 12
Second
First
First
First
For the first test case, here is an example of how the game might proceed:
* Before the game starts, $S$ is `(()())`.
* Taro deletes the first character of $S$, resulting in `()())`.
* Next, Jiro deletes the last character of $S$, resulting in `()()`.
* Next, Taro deletes the last character of $S$, resulting in `()(`.
* Next, Jiro deletes the last character of $S$, resulting in `()`, and the length of $S$ becomes $K=2$, so the game ends.
* The final $S$ is a correct bracket sequence, so Jiro wins.
In the third test case, for example, Taro can win by declaring termination on the first turn.{
"problem": {
"name": "Bracket Game",
"description": {
"content": "There is a string $S$ consisting of `(` and `)`. Taro and Jiro will play the following game using this string. Taro goes first and Jiro goes second; they alternately choose and perform one of the foll",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc209_a"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a string $S$ consisting of `(` and `)`.\nTaro and Jiro will play the following game using this string.\nTaro goes first and Jiro goes second; they alternately choose and perform one of the foll...",
"is_translate": false,
"language": "English"
}
]
}