rahulpadhy's blog

By rahulpadhy, history, 2 weeks ago, In English,

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

  • Vote: I like it  
  • +1
  • Vote: I do not like it  

9 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Please do take a look :)