Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
What actually tells us the trailing zeros of the product of a path?
It is the sum of the exponents of 2 and sum of the exponents of 5 of the prime factorizations of the numbers on that path. The smaller of the two is the answer for that path.
We can then treat each cell as the elbow point and calculate the largest minimum (sum of 2 exponents, sum of 5 exponents) from the combination of top-left, top-right, bottom-left and bottom-right.
To do this efficiently, we should use the prefix sum technique.