BAT4 - BATMAN4
" Batman: A hero can be anyone. Even a man doing something as simple and reassuring as putting a coat around a little boy's shoulder to let him know that the world hadn't ended."
THE BOMB IS TRIGGERED !!, IT WOULD BLOW OFF IN A FEW MINUTES !!
BATMAN resorts to his BAT and decides to head towards the ocean with the bomb.
However in front of him lies a huge grid of tall buildings. Starting from the top-leftmost grid he needs to move to the bottom right-most grid to reach the ocean. Since the fuel of BAT has nearly exhausted, BATMAN decides to chose a path where the maximum up distance travelled at a time is minimized. However, each movement of the BAT up or down the building takes one unit of time. (Horizontal movements can be made in no time). The clock keeps ticking, So BATMAN decides to choose a path reaching the destination minimizing the maximum up distance and with as much time left as possible.
Every Hero Has a Journey. Every Journey Has an End !
"CatWoman :You dont owe these people anymore. You've given them everything
BatMan :Not everything, Not Yet. "
BatMan requires to take the first jump on (1,1)
Print NO is no time is left
minimum max up-distance is the first priority.
The first line contains T, the number of testcases.
In each testcase, the first line contains N (the size of the grid) and M (the time left).
The next N lines contain N integers, denoting the heights of the building.
If BATMAN could reach the destination, print "
YES", the maximum up distance travelled and the maximum time left with BATMAN.
If he could not reach the destination within time, print "
1 <= N <= 20
1 <= M <= 100
Input: 1 3 40 2 4 3 4 5 3 2 4 6
Output: YES : 2 32
Could someone explain what question is demanding ? Very tricky and ambiguous language, poor description.
considering all 4 directions - tle
This is horrible, SPOJ should really let people other than the author edit problem statements
Last edit: 2017-09-27 05:44:51
Spoj Toolkit is also giving incorrect results as to the case of Rohit Kumar my solution is also giving YES : 12 76
Problem is very badly described. It surely deserves a downvote.
The toughest part of the problem was the problem statement itself. Please edit it so that it could be easily understandable.
spoj toolkit gives wrong answer for this question for some test cases
The problem is very easy and interesting however poorly worded. Do note that we have to minimize max-UP (but not down) distance. I kept trying to minimize max vertical distance and almost lost my mind due to WAs I was getting because of that. All the test case mentioned here and there couldn't detect my blunder. So please read this problem extra carefully.
height[i][j] < 2^10