CATM SPOJ

Revision en1, by rahulpadhy, 2017-05-14 07:53:16

I need some help in this problem. I think that my approach is correct, but I am getting WA unfortunately. Please do help..

Here's the link to the question: http://www.spoj.com/problems/CATM/

My approach is as follows :

  1. If the mouse is at the edge of the field,i.e., if its x-co-ordinate=1 or n and if its y-co-ordinate=1 or m, then it can escape.

  2. If both the cats and the mouse lie in a diagonal(either left diagonal or right diagonal) with the mouse in the middle, then the mouse can't escape.

  3. For any other condition, the mouse can escape.

Here's the link to my solution : http://ideone.com/exE3j3

Tags spoj, ad-hoc

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English rahulpadhy 2017-05-14 07:53:16 635 Initial revision (published)