Link to the problem: http://www.usaco.org/index.php?page=viewproblem2&cpid=644
It’s described in the analysis …
Thanks again, Ben, for your help!