303911: CF754B. Ilya and tic-tac-toe game

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

Description

Ilya and tic-tac-toe game

题意翻译

题目大意: 伊莉雅是一个4x4井字棋的年迈棋手,他总是用x(英文小写)棋,今天,他跟他的朋友亚瑟玩了很多很多局游戏,亚瑟很累了,但是现在还剩下最后一场游戏,现在轮到伊莉雅下棋,请问伊莉雅下完这颗棋子后能否取得胜利? 井字棋规则: 棋盘的规格为4*4,其中伊莉雅棋子为x,亚瑟的棋子为o(英文小写o),x先下,o后下,当某种棋子在棋盘上连成三个时取得胜利!(这三个棋子可以是水平、竖直或斜方向的连续三个) 输入输出格式: 输入格式: 输入的数据为给定的棋盘,其中.为空格,x(英文小写)为伊莉雅的棋子, o(英文小写)为亚瑟的棋子,棋盘保证有空格子,现在轮到伊莉雅。 (有可能整个棋盘都没有棋子,意味着亚瑟还没有下) 输出格式: 输出为单行:如果伊莉雅下完一颗棋子后能够取得胜利,输出YES,如果不能,则输出NO。 感谢@icebird 提供的翻译

题目描述

Ilya is an experienced player in tic-tac-toe on the $ 4×4 $ field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have won the game by making single turn or not. The rules of tic-tac-toe on the $ 4×4 $ field are as follows. Before the first turn all the field cells are empty. The two players take turns placing their signs into empty cells (the first player places Xs, the second player places Os). The player who places Xs goes first, the another one goes second. The winner is the player who first gets three of his signs in a row next to each other (horizontal, vertical or diagonal).

输入输出格式

输入格式


The tic-tac-toe position is given in four lines. Each of these lines contains four characters. Each character is '.' (empty cell), 'x' (lowercase English letter x), or 'o' (lowercase English letter o). It is guaranteed that the position is reachable playing tic-tac-toe, and it is Ilya's turn now (in particular, it means that the game is not finished). It is possible that all the cells are empty, it means that the friends left without making single turn.

输出格式


Print single line: "YES" in case Ilya could have won by making single turn, and "NO" otherwise.

输入输出样例

输入样例 #1

xx..
.oo.
x...
oox.

输出样例 #1

YES

输入样例 #2

x.ox
ox..
x.o.
oo.x

输出样例 #2

NO

输入样例 #3

x..x
..oo
o...
x.xo

输出样例 #3

YES

输入样例 #4

o.x.
o...
.x..
ooxx

输出样例 #4

NO

说明

In the first example Ilya had two winning moves: to the empty cell in the left column and to the leftmost empty cell in the first row. In the second example it wasn't possible to win by making single turn. In the third example Ilya could have won by placing X in the last row between two existing Xs. In the fourth example it wasn't possible to win by making single turn.

Input

题意翻译

题目大意: 伊莉雅是一个4x4井字棋的年迈棋手,他总是用x(英文小写)棋,今天,他跟他的朋友亚瑟玩了很多很多局游戏,亚瑟很累了,但是现在还剩下最后一场游戏,现在轮到伊莉雅下棋,请问伊莉雅下完这颗棋子后能否取得胜利? 井字棋规则: 棋盘的规格为4*4,其中伊莉雅棋子为x,亚瑟的棋子为o(英文小写o),x先下,o后下,当某种棋子在棋盘上连成三个时取得胜利!(这三个棋子可以是水平、竖直或斜方向的连续三个) 输入输出格式: 输入格式: 输入的数据为给定的棋盘,其中.为空格,x(英文小写)为伊莉雅的棋子, o(英文小写)为亚瑟的棋子,棋盘保证有空格子,现在轮到伊莉雅。 (有可能整个棋盘都没有棋子,意味着亚瑟还没有下) 输出格式: 输出为单行:如果伊莉雅下完一颗棋子后能够取得胜利,输出YES,如果不能,则输出NO。 感谢@icebird 提供的翻译

加入题单

上一题 下一题 算法标签: