Peg Test - March 9

Question 4

Given a grid of X's and O's, output whether or not there is a row of 4 X's in a row, either vertically, horizontally, or diagonally.

Input

T, representing how many cases there are to follow.

Then, T 4x4 grids of X's and O's

There will be a blank line in between each new grid.

Output

Yes, if there is a row of 4 X's in a row. No, otherwise.

Sample Input

2
XXXX
OOOO
OOOO
OOOO
 
XOOX
OXXX
XXOO
OXOX

Sample Output

Yes
No

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 08, 2011

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

I tried every test case I could come up with, yet I still get 6/15.
Plz could anyone help, it would be greatly appreciated. THX.

Your code will fail for the following case:

XXXX 
OOOO
OOOO
OOOX

Where does the blank go and do you output all the outputs at once, or after each case?

When you output does not matter. The judge takes all the answers after the program ends, and compares it to the answer key. The blank goes after each new grid as it says. You can highlight the input to see where the blanks are if you really need to.