Union Training II - Dynamic Programming

C: TaoSama