Physical experiments
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
As you already know, Zenyk and Marichka are preparing for the ZNO. This time — in physics.
Our heroes have an electrical circuit with \(n\) lamps, numbered from 1 to \(n\). Initially, some of them are on, and some are off.
Since Zenyk believes they have prepared enough, he wants to turn off all the lamps and finally go home.
To turn off all the lamps, Zenyk must make exactly \(n\) moves; on the \(i\)-th move, he chooses exactly \(i\) lamps and toggles all of them simultaneously.
Is it possible to turn off all the lamps using such moves?
Input
The first line contains a number \(n\) — the number of lamps.
In the second line, a string \(s\) of \(n\) characters is given — the initial state of the lamps (0 means the corresponding lamp is off, 1 means it is on).
Output
If it is impossible to turn off all the lamps, output No
on a single line.
If the answer exists, output Yes on the first line.
Then, in each of the next \(n\) lines,
output the numbers of the lamps (1-indexed) that Zenyk must toggle on
this move. If there are several answers, output any of them.
Constraints
\(20\%\) of tests: \(1 \le n \le 10\).
\(20\%\) of tests: \(n \le 300\), initially all lamps are in the same state.
\(60\%\) of tests: \(n \le 300\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 3 101 | Yes 3 2 3 1 2 3 |
| Input (stdin) | Output (stdout) |
|---|---|
| 2 00 | No |
Notes
In the first example, after the first move, the lamps will be in state \(100\), after the second — \(111\), and after the third — \(000\).
In the second example, it can be shown that no matter how Zenyk acts, he will not be able to turn off all the lamps, and therefore he has to study physics further...
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|