結果 : maximizing elements with constraints hackerrank solution