Rollback: N Bishops Problem

This problem is driving me crazy ... Place N bishops aboard the NxN so that all squares are occupied or attacked by at least one of them.

Can someone help me with an algorithm to solve this problem?

+3
source share
4 answers

Why come back? Use a small number of solutions to obtain evidence.

Even a greedy algorithm will be enough: count the number of squares available from each square. Select the square with the largest coverage that does not overlap with the previously selected coverage. Repeat.

Ambiguity generates horizontal, vertical, and lateral deviations.

N , . , . , , , . .

.

+1
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
_ _ _ _ ♗ _ _ _ _
+6
+2

, , - , .

, - - B_i * W_j, i + j = N. ( ), , , , , . , - . , , .

, - N.

+2

Source: https://habr.com/ru/post/1740667/


All Articles