Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Ships
Description Probably everyone who ever attended school knows the game where two opposing players place a set of ships on a sheet of paper and try to eliminate each other's ships by guessing their location.
In our version of the game, your opponent has distributed the following seven ship patterns over a rectangular grid of squares:
- 'x' if a ship covers the square
- 'o' if no ship covers the square
- '.' if the square has not yet been uncovered
Given that information, you are to decide whether you can determine all remaining 'x' squares with at most one miss, i.e. whether you could uncover the '.' squares without getting more than one 'o' square before you had all 'x' squares uncovered. This means you are allowed to hit a 'o' if then the solution becomes unique. Input The input file contains several game situations. Every test case starts with a line containing two integers h and w. These define width and height of the game rectangle, where 2 <= w, h <= 16.
Each of the next h lines contains a string of w characters. Each of these characters is either `x', `o' or `.', depending on the state of the corresponding square. A blank line separates each game from the next. The input file ends with a game having w = 0 and h = 0. This game should not be processed. Output For each test case you should first output a line containing the number of the game, followed by a line containing either `yes.' (if you can determine all `x' with at most one miss) or `no.' (if you cannot determine all `x' without at least two misses).
Output a blank line after every game. Sample Input 10 10 .x..x..... oooooxoooo oxooxxx... xxoooooo.. xoooxooo.. ooxxxxoo.. oooooxxoox ooooooxoox ooooooooxx oooooooooo 0 0 Sample Output Game #1 yes. Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator