luogu#P10957. 环路运输
环路运输
Problem Description
Along a circular road, there are warehouses evenly spaced, numbered from to . The distance between warehouse and warehouse is defined as , that is, the shorter one of the counterclockwise or clockwise distance from to .
Each warehouse stores some goods. The inventory of warehouse is .
The cost to transport goods between warehouses and is .
Find between which two warehouses the transport cost is the maximum.
Input Format
The first line contains an integer .
The second line contains integers .
Output Format
Output one integer, the maximum cost.
5
1 8 6 2 5
15
Hint
Constraints: , .
Translated by ChatGPT 5