|
||||||||||
Five in a RowTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 497 Accepted Submission(s): 220 Problem Description The ACM Team of WHU is planning an online AI arena for Go-bang (Five in a Row). Now, we need some help. We all know the famous game "Five in a Row". It is traditionally played with go pieces (black and white stones) on a go board (15x15 intersections). The winner is the first player to get an unbroken row of five stones horizontally, vertically, or diagonally. We now have an uncompleted game, that is to say, yet no one won. You are required to tell us that whether the next player could win within one step or not. Input The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases. Each test case is a 15 * 15 go board, 'B' represent for a black stone while 'W' for white ones. '.' represents cross with no stone represented by 0. [Technical Specification] T is an integer, and T <= 20. The number of white stones is either equal or 1 less than the number of black stones. There is at least ONE '.' in each test case. Test cases are separated by ONE empty line. You can assume that black player goes first. Output For each test case, print a single line containing the result. If the next player could win within one step, display 'YES', otherwise, display 'NO'. Sample Input
Sample Output
Source | ||||||||||
|