Given 2n counters where n > 1. You have to place these 2n counters on an n × n board so that no more than
two counters are in the same row, column, or diagonal.
Since we need to place 2n counters into n rows and n columns of the given n x n board, with the condition that there can be at most two counters in the same row or in the same column. From this , we can conclude that exactly two counters have to be placed in each row and column.
Case 1 : For even n = 2k, we can obtain a solution by identical placement of n counters in the first k columns and the last k columns as explained below.
Let us assume that rows and columns of the board are numbered top to bottom and left to right, respectively.
Place two counters in the first two rows of columns 1 and k + 1, two counters in rows 3 and 4 of columns 2 and k + 2, and and so on, until finally counters are placed in rows n – 1 and n of columns k and 2k. Let us understand this with the help of an example when n = 8 :
Case 2 : For odd n = 2k + 1, k > 0, we can obtain a solution by placing two counters in rows 1 and 2 of column 1, two counters in rows 3 and 4 of column 2, and so on until counters are placed in rows n – 2 and n – 1 of column k. Then two counters are placed in the first and last rows of column k + 1. After that, k counters are placed in the right part of the board symmetrically with respect to the board’s central square to those in the left part: two counters are placed in rows 2 and 3 of column k + 2, in rows 4 and 5 of column k + 3, and so on, until rows n – 1 and n of the last column.Let us understand this with the help of an example when n = 7 :
References : Algorithmic Puzzles – Anany Levitin, Maria Levitin
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : HiteshSaini