USACO Platinum 2018 February - At Large

Author: Benjamin Qi

Official Analysis

Solution (O(NN)O(N\sqrt N))

See Eric Zhang's comment.

Alternate (Fake) Solution

First write some O(N2)\mathcal{O}(N^2) DP that is somehow fast enough to pass test cases 1-6.

Code

This won't work for test cases 7-11, but these test cases are quite special!

How So?

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!