Preparing NOJ

Gomoku

1000ms 262144K

Description:

Alice and Bob are playing a game called Gomoku (a.k.a. Five in a Row). Alice is sente(black, moves first) and Bob is gote(white, moves second). Alice wants to know whether she can win(have five or more consecutive stones of the same color in a diagonal, vertical, or horizontal row) in one step, and now is Alice's turn. It is guranteed that neither Alice or Bob wins currently. Prohibitions are not considered in this problem.

Input:

The first line contains one integer $$$n$$$, which denotes the size of the board is $$$n \times n$$$.

Next $$$n$$$ lines each has a string of length $$$n$$$, use @ to represent black, O to represent white, + to represent there's no stone at that position.

Output:

If Alice can win in one step, output YES, otherwise output NO.

Sample Input:

7
+++O+++
+@+@+++
+O@@@++
+++@+++
+++O@++
++OOOO+
+++++++

Sample Output:

YES

Info

NOJ

Provider NOJ

Code NOJ2409

Tags

Submitted 179

Passed 28

AC Rate 15.64%

Date 11/16/2019 23:11:35

Related

Nothing Yet