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

Сборники > Kovrov IT > задача:


2010.C. 50255 - Bishops

Гость
• Обсуждение задачи (1)

Задачи сборника

• 2007.A. 50671 - Phalanx
• 2007.B. 50270 - Bitsorting
• 2007.E. 50663 - Lights
• 2007.G. 50272 - Strange Numbers
• 2007.H. 50273 - Two Captains
• 2007.I. 50274 - Boundary Troops
• 2007.J. 50275 - Wedding
• 2007.F. 50690 - Parliament
• 2010.C. 50255 - Bishops

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

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

Лимит времени 3000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Кирилл Бутин, ПГУ. Сложность Эпсилон

A bishop is a piece in the board game of chess. The bishop has no restrictions in distance for each move, but is limited to diagonal movement, forward and backward.

Consider a chessboard of size NxN.

Your must find the maximum number of bishops that can be placed on the chessboard, such that no pair of bishops can attack each other. Some cells are damaged. Bishops cannot be placed on these cells, but they can attack through them.

Input
The first line contains one integer N (1 ≤ N ≤ 100) - size of the chessboard. The following N lines describe the chessboard. Each line contains N symbols. '.' is entire cell, '#' is damaged.

Output
Output a single integer - the number of bishops that can be placed on the chessboard under the given restrictions.

Input 1 Output 1
2
..
..
2
Input 2 Output 2
2
.#
#.
1

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

www.contester.ru