Problem: [http://www.usaco.org/index.php?page=viewproblem2&cpid=194][1]
Solution: [http://www.usaco.org/current/data/sol_cbs.html][2]
In the solution for this problem, I am confused as to what L, R, mp, and lft do in the program. My current thoughts are:
L: Maintains cumulative sum for each individual array
R: The index where a particular cumulative sum for a certain array was last seen
lft: Completely lost…
mp: Completely lost… What is the point of mp if only mp[L] is modified? Why is mp[L] incremented?
In addition, if my thoughts on L and R are correct, why are the indices set to i+1 instead of i?
Please help, and thanks in advance!
vmaddur
[1]: http://www.usaco.org/index.php?page=viewproblem2&cpid=194
[2]: http://www.usaco.org/current/data/sol_cbs.html