usaco 1-5 Broken Necklace