HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


51014 - Nine Men's Morris game

Guest
• Review clarifications (1)

Volume problems

• 50789 - Number of Cities
• 50983 - Course Selection
• 51024 - Total Stock Price
• 50987 - Very Looong Queue
• 50913 - Manhattan Distance
• 51008 - Sum of Regional Maxes
• 50729 - Max number in 2D array
• 50981 - Top popular m-students
• 51014 - Nine Men's Morris game
• 50743 - Total Scholarships Discount
• 50740 - Service Time - 1
• 50988 - Laplacian Filter
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50928 - War Of Battleships
• 50930 - Tom and Jerry
• 50925 - Optimizing Elevator Usage

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Nine Men's Morris game

In Nine Men's Morris game, the players try to place their pieces on adjacent points so that they can remove one of the opponent pieces. For example the pieces on b2, d2 and f2 are adjacent on a line. Similarly, the pieces on d7, d5 and d6 are also adjacent on a line. But the pieces on b4, c4 and e4 are not adjacent on a line.

Question: Write a program that reads the positions of 4 pieces and decides if any three are adjacent on a line.

Input specification: You will be given the coordinates of 4 pieces, a letter and an integer separated by a space.

Output specification: Show "Yes" if any three are adjacent on a line, or "No" otherwise.

Sample Input 1
a7 d6 d7 g7

Sample Input 2
b4 c4 e4 g4
Sample Output 1
Yes
Sample Output 2
No

Explanation: In the first sample, the pieces a7, d7, and g7 are aligned on a line.
In sample 2, no three pieces are aligned on a line.



Для отправки решений необходимо выполнить вход.

www.contester.ru