Pro.ID10079 TitleSecurity Panel Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10079 AC0 Submit0 Ratio- 时间&空间限制描述Advanced Control Mechanisms (ACM) produces sophisticated electronic locks and security devices. For example, consider the following pattern where pressing a button switches the state of the button pressed, as well as the button above and the buttons to the upper and lower left. 输入Each input case will begin with the number of rows and columns on the panel, 1 ≤ r, c ≤ 5 alone on a line. The next three lines describe how pressing a button will affect the nearby lights. This description consists of a 3x3 character grid, where the character "*" indicates that the light in that position switches state (from lit to unlit or from unlit to lit) while "." means its state remains unchanged. 输出Description Advanced Control Mechanisms (ACM) produces sophisticated electronic locks and security devices. For example, consider the following pattern where pressing a button switches the state of the button pressed, as well as the button above and the buttons to the upper and lower left. Input Each input case will begin with the number of rows and columns on the panel, 1 ≤ r, c ≤ 5 alone on a line. The next three lines describe how pressing a button will affect the nearby lights. This description consists of a 3x3 character grid, where the character "*" indicates that the light in that position switches state (from lit to unlit or from unlit to lit) while "." means its state remains unchanged. Output For each input case, output "Case #" followed by the number of the case. If there is no way to turn on all the lights, print "Impossible." If it is possible to turn on the lights, output the buttons to be pressed in increasing order, separated by single space. Output the answer that requires the fewest number of buttons possible to be pressed. Sample Input 2 3
**.
.*.
*..
4 5
.*.
***
.*.
2 2
...
.**
...
4 3
*.*
...
..*
0 0 Sample Output Case #1
2 5 6
Case #2
2 3 4 7 9 12 14 17 18 19
Case #3
1 3
Case #4
Impossible. Source 样例输入2 3
**.
.*.
*..
4 5
.*.
***
.*.
2 2
...
.**
...
4 3
*.*
...
..*
0 0 样例输出Case #1
2 5 6
Case #2
2 3 4 7 9 12 14 17 18 19
Case #3
1 3
Case #4
Impossible. 作者 |