Answer:
We solve the problem with the following algorithms:
1. Order A is in the increasing order.
2. Order B is in the decreasing order.
3. Return (A,B).
Step-by-step explanation:
We need to show that this gives an optimal solution. without the loss of the generality, we can assume that a₁ ≤ a₂ ......≤ aₙ in the optimal solution. Since the payoff is \prod_{i}^{n}=1^{a_{i}^{bi}}, the payoff will always increase if we make a change so that b_{i+1} > b_{i}. Therefore the optimal solution will be found if B is sorted.
The running time is O(n log(n)) since we sort two vector.