P3101 [USACO14JAN] Ski Course Rating G
Description
The cross-country skiing course at the winter Moolympics is described by an M x N grid of elevations (1
Input Format
\* Line 1: The integers M, N, and T.
\* Lines 2..1+M: Each of these M lines contains N integer elevations.
\* Lines 2+M..1+2M: Each of these M lines contains N values that are either 0 or 1, with 1 indicating a cell that is a starting point.
Output Format
\* Line 1: The sum of difficulty ratings of all starting points (note that this may not fit into a 32-bit integer, even though individual difficulty ratings will).
Explanation/Hint
The ski course is described by a 3 x 5 grid of elevations. The upper-left and lower-right cells are designated as starting points. From each starting point, we must be able to reach at least 10 cells.
The difficulty rating of the upper-left starting point is 4, and for the lower-right it is 20.