Editorial for Singularity Cup P1 - Maximum Permutation Product
Submitting an official solution before solving the problem yourself is a bannable offence.
We can compute the value of every possible subarray and determine which one yields the highest value.
When , it is always optimal to include the entire array excluding if or .
is an edge case where choosing the subarray that only contains the element is always optimal.