Maniacal Midsummer Marathon 2014 by AL, TL, JJ
Dorian loves pies, and he especially loves his local pie shop - that's
why he's bought an all-you-can-eat pie dinner! The pies have been
arranged into a grid with
Two pies respectively located at
Input Specification
The first line contains two space-separated integers
The next
Output Specification
A single line containing two space-separated integers: the maximum
possible sum and the number of ways to reach this sum. Since the number
of ways may be very large, you should give the value modulo
Sample Input 1
3 4
1 2 3 1
5 7 2 1
1 4 1 0
Sample Output 1
14 3
Sample Input 2
3 3
1 1 0
0 0 1
1 1 0
Sample Output 2
3 5
Scoring
If your output is incorrectly formatted, then your program will score
Otherwise, if you correctly determine the first number but not the
second, then your program will score
If both numbers are correct, then you will receive
Subtask | Score | Constraints |
---|---|---|
No additional restrictions. |
Comments