ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN303 2013-15 Questions > задача:


15Rst-10. 50857 - Nine-Stones Game

CEN303 2013-15 Questions

Старт: 15.дек.2013 в 14:00:00
Финиш: 15.дек.2013 в 19:00:00
Турнир завершён!
• Турнирная таблица

Задачи турнира

• 15MdE-20. 50803 - Sum of the dept...
• 15MdE-40. 50805 - Sum of the weig...
• 15PrE-10. 50816 - Largest Sum Path
• 15PrE-20. 50817 - The Knight Move
• 15PrE-30. 50818 - Depth Limited BST
• 15PrE-40. 50819 - Linked Numbers
• 15PrE2-01. 50847 - The first m train...
• 15PrE2-06. 50837 - Sum is equal to K
• 15Rst-10. 50857 - Nine-Stones G...
• 2.15FE-03. 50996 - Checkers - the ...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Nine-Stones

Nine-stones game is an old game played on a board similar to the one on the right. The purpose of the game is to put 3 same color stones in a row, (on the same continuous line) so that you can remove one piece from your opponent. Number positions and adjacency list is given in the second image. For example in the third image, the green stones are aligned on a straight-line while orange and black pieces are not.

Question:
You are going to be given the coordinates of n-stones for two players. According to the given stone order, find the first color which aligns three stones on a row (on an adjacent straight-line).

Input specification
Firstly, you are going to be given a number (n) the number of pieces to be placed on the board where 0 ≤ n ≤ 16. Then in the following n lines, you are going to be given the coordinates and colors (black or white) of n pieces.

Output specification
Show color of the first group which aligns on a line the first. Show the message "No", if no group aligns the pieces on a line.

Sample Input I
6
4 w
7 b
8 b
5 w
6 w
9 b
Sample Input II
6
7 b
8 b
9 b
2 w
10 w
16 w
Sample Output I
w
Sample Output II
No


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

www.contester.ru