AC2
find global maximum firstly
then calculate the left side and right side respectively