Table of Contents

HintSolutionBonus

Hint

Hint 1

Solution

Official Analysis (C++)

Spoiler

Bonus

Solve the problem in O(N)O(N) time.

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!