I am trying to solve this problem using ternary search.
It asks to find the maximum of the function x^a·y^b·z^c. Where, x+y+z <= S.
I submitted the following solution which is giving WA. link
However, this AC solution is very similar.
Can somebody help ?