In a fishing contest, the participants fish in a lake, represented as a 2D grid of dimension r×c. Each integer point in the grid contains fish.
At point (x,y), fish first appear at second t_x,y and disappear just before time t_x,y+k seconds. Outside of this time, no fish can be caught at this position. It takes no time to catch all the fish at a point, and all points contain the same amount of fish. Furthermore, moving to the point immediately north, west, south or east from the point you are currently at takes exactly 1 second.
Assume that you start at some position (x_0,y_0) at second 1, and can catch fish until (and including) second l. From how many points in the lake can you catch fish, if you travel optimally on the lake?
The input consists of:
Output the maximum number of points you could catch fish from.