-1

We are given a chessboard of size 'N' X 'N' . But it can contain any numbers of white-squares and black-squares , that too in any-order .

Say there are 'a'-squares of white color and 'b'-squares of black-color , then ,

[ a+b=n*n ]

We have to keep on making move with black-squares on the chessboard till there is no move left.

This is what happens in a move:-

1)We choose a black-square at co-ordinate:-(row,column) and move it to (row-1,column+1) , only if the co-ordinate (row-1,column+1) also contains a black-square . After it is moved to the new-position , the old-position,i.e, [row,column] becomes empty, i.e , its color turns to white .

OR

2)We choose a black-square at co-ordinate:-(row,column) and move it to (row-1,column-1) , only if the co-ordinate (row-1,column-1) also contains a black-square .After it is moved to the new-position , the old-position,i.e, [row,column] becomes empty, i.e , its color turns to white .

We have to end this game in least number of moves and the question is to find the sequence of those moves .

Lets denote black-square by '1' and white-square by '0' .. ...

Example:-

3X3 chessboard:-

0 1 0

1 0 1

0 0 0

Sequence of move(s) which ends the game in minimum number of moves : -

1)Move the black-square at [1,0] to [0,1]...Now the chessboard looks like this : -

0 1 0

0 0 1

0 0 0

2) We move the black-square at [1,2] to [0,1] and the chessboard looks like this:-

0 1 0

0 0 0

0 0 0

Now, there are no valid moves left and the game ends :-)

Given a chessboard of size 'N' x 'N' and any configuration of black and white-squares, how to find the sequence of moves which ends the game in minimum number of moves ?

  • 2
    This seems to be one of the questions on the current codechef contest. – Jaap Scherphuis May 09 '19 at 08:46
  • It is a violation of the rules of this site to post problems from current contests. – saulspatz May 09 '19 at 08:50
  • I don't think my question matches with any ongoing contest , it was asked to me by a fried and I can't see any similarity, stop the blaming when there is no similarity, in this way, I CAN SAY THAT EVERY QUESTION IS SIMILAR TO SOME OTHER QUESTION :( – Firex Firexo May 09 '19 at 09:31
  • If you follow the link I gave in my previous comment, you will see that it is the same, except that it uses pawns instead of black squares. Tell your friend not to cheat. – Jaap Scherphuis May 09 '19 at 09:50
  • @saulspatz where is this rule published? – גלעד ברקן May 09 '19 at 11:34
  • @גלעדברקן Even if it were not a https://math.meta.stackexchange.com/questions/16774/contest-problem-policy policy of this site (leading to something as mild as locking), such a question is certainly against the rules of the contest site (leading to disqualification). – Hagen von Eitzen May 09 '19 at 17:34
  • @HagenvonEitzen what you linked to seems to be an answer to what is the policy for moderators. It's not an official "rule of conduct" on math.stackexchange. saulspatz said "violation of the rules of this site." What you provided does not support that kind of language. – גלעד ברקן May 09 '19 at 17:42
  • Voting to close because it comes from an on-going contest. – Lee David Chung Lin May 10 '19 at 00:33

0 Answers0