CF825B.Five-In-a-Row
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
爱丽丝和鲍勃玩五子棋游戏。他们使用一个 10×10 的棋盘。两人轮流在空格中放置棋子,每次一子:爱丽丝放“×”,鲍勃放“○”。
当前对局已进行若干步,现在轮到爱丽丝走棋。她想知道:是否能在某个空格中放置一个“×”,从而立即获胜?
当棋盘上存在至少连续 5 个“×”(即长度不小于 5 的同色连线)时,爱丽丝获胜。该连线可以是水平、垂直或对角线方向。
输入格式
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.
给你一个 10×10 的矩阵(共 10 行,每行 10 个字符),其中大写拉丁字母 'X' 表示“叉”,字母 'O' 表示“圈”,字符 '.' 表示空格。矩阵中 'X' 的个数等于 'O' 的个数,且至少各有一个。至少存在一个空格。
保证在当前布局下,双方均尚未获胜。
输出格式
Print 'YES' if it's possible for Alice to win in one turn by putting cross in some empty cell. Otherwise print 'NO'.
如果爱丽丝可以通过在某个空格中放置一个“×”而在一回合内获胜,则输出 YES;否则输出 NO。
输入输出样例
输入#1
XX.XX..... .....OOOO. .......... .......... .......... .......... .......... .......... .......... ..........
输出#1
YES
输入#2
XXOXX..... OO.O...... .......... .......... .......... .......... .......... .......... .......... ..........
输出#2
NO
输入解题思路,AI测评打分。不知道怎么写?