Problem 2786 · Medium

Visit Array Positions to Maximize Score

Each move forward adds a value and pays a penalty when the parity changes, so the best score at each position comes from its best earlier position.

Open the interactive visualisation