304324: CF825B. Five-In-a-Row

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Five-In-a-Row

题意翻译

给一个10*10的棋盘,下五子棋,问再下一个X以后,X是否能直接胜利,能输出"YES",否则输出"NO"。 五子棋胜利定义为连续五个相同棋子横着,竖着,或斜着。

题目描述

Alice and Bob play 5-in-a-row game. They have a playing field of size $ 10×10 $ . In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts. In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins immediately. Alice wins if some crosses in the field form line of length not smaller than 5. This line can be horizontal, vertical and diagonal.

输入输出格式

输入格式


You are given matrix $ 10×10 $ (10 lines of 10 characters each) with capital Latin letters 'X' being a cross, letters 'O' being a nought and '.' being an empty cell. The number of 'X' cells is equal to the number of 'O' cells and there is at least one of each type. There is at least one empty cell. It is guaranteed that in the current arrangement nobody has still won.

输出格式


Print 'YES' if it's possible for Alice to win in one turn by putting cross in some empty cell. Otherwise print 'NO'.

输入输出样例

输入样例 #1

XX.XX.....
.....OOOO.
..........
..........
..........
..........
..........
..........
..........
..........

输出样例 #1

YES

输入样例 #2

XXOXX.....
OO.O......
..........
..........
..........
..........
..........
..........
..........
..........

输出样例 #2

NO

Input

题意翻译

给一个10*10的棋盘,下五子棋,问再下一个X以后,X是否能直接胜利,能输出"YES",否则输出"NO"。 五子棋胜利定义为连续五个相同棋子横着,竖着,或斜着。

加入题单

算法标签: