Codeforces Round 1012 (Div. 1)
D
Conditional Operators
Codeforces
3200
原题
← C2E →
翻译中…

In C++, the conditional operator ?: is used as the value of x?y:z is $y$ if $x$ is true; otherwise, the value is $z$. $x$, $y$, and $z$ may also be expressions. It is right-associated; that is, a?b:c?d:e is equivalent to a?b:(c?d:e). $0$ means false and $1$ means true.

翻译中…

Given a binary string with length $2n+1$, you need to show whether the value of the expression can be $1$ after inserting $n$ conditional operators into the string. You can use parentheses. For example, the string 10101 can be transformed into (1?0:1)?0:1, whose value is $1$.

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 10\,000)$, the number of test cases. The description of the test cases follows.

翻译中…

In the first line of each test case, there is a single integer $n$ ($1 \le n \le 1.5 \cdot 10^5)$.

翻译中…

In the second line of each test case, there is a binary string of length $2n + 1$.

翻译中…

It is guaranteed that the sum of $n$ across all test cases does not exceed $1.5 \cdot 10^5$.

翻译中…

Output

翻译中…

For each test case, on the first line, output Yes if the string can be transformed into an expression of value $1$; otherwise, output No.

翻译中…

If the answer is Yes, output the expression on the second line. You can use parentheses, but the order of the characters in the original string must remain the same. The length of your expression must be no more than $10n+1000$.

翻译中…

Note

翻译中…

The first test case — is the one mentioned in the problem description.

翻译中…

In the second test case, it is clear that regardless of how the conditional operator is used, the result will always be zero.

翻译中…

样例

Input #1
2
2
10101
2
00000
Output #1
Yes
(1?0:1)?(0):1
No
InputCopy OutputCopy
题目信息
题号
2089D
时间限制
2 s
内存限制
256 MB
标签
构造

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。