- 194
Statement
Goal
You are a duck sitting in the top left field of a W×H-sized lake.In every field of the lake is a different amount of food.
Your duck is only allowed to move to the right or down.
What is the maximum amount of food you can eat before reaching the bottom right field?
This puzzle is a followup to The hungry duck - part 1
This time you are swimming on bigger lakes. Performance is important.
Input
Line 1: Two space separated integers W and H for the width and height of the room
Next H lines: W integers for the amount of food
Next H lines: W integers for the amount of food
Output
Line 1: The maximum amount of food you are able to eat.
Constraints
0 < W,H <= 100
0 < Amount of food < 256
0 < Amount of food < 256
Example
Input
15 15 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
Output
2066
A higher resolution is required to access the IDE