HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Graph problems and UF > problem:


50255 - Bishops

Guest
• Discussion of problem (1)

Section problems

• 50255 - Bishops
• 50261 - Roads
• 50690 - Parliament
• 50700 - Candidates for the Mayor
• 50692 - How much money?
• 50694 - The Cheapest Flight
• 50841 - My grand-grand-grandfather
• 50697 - Base Stations
• 50695 - Longest link between neurons

Feedback

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

Time limit 3000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Кирилл Бутин, ПГУ. Difficulty Epsilon

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