1 人解决,1 人已尝试。
1 份提交通过,共有 1 份提交。
8.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
In Byteland there is a match planned between two antagonistic football teams: the Linuxers and the Microsofters. Because the fans of both teams are known to have a deep aversion to fans of the other team, they should watch the match only on TV and ought to be located in towns that are in the greatest possible distance to one another. Byteland is an island, and all its towns lie along the seashore. A two-way highway connecting all the towns runs along the coast. From each town one can reach any other town going clockwise or counterclockwise. The length of the shorter route is the distance between the two towns.
Task
Write a program which:
1.reads the description of the island,
2.computes the maximal distance the fans of one team may be separated from the fans of the other team,
3.writes the result.
In the first line there is one positive integer n, 2<=n<=50 000, denoting the number of towns on the island. In the following n lines there are the lengths of the highway sections between adjacent towns. Each of the lines contains one positive integer. In the line numbered i+1 there is the length of the highway section between the town number i and the town number i+1, while in the line numbered n+1 there is the length of the route between the towns n and 1. The whole length of the highway does not exceed 1 000 000 000.
The first and only line should contain one integer being the maximal distance the fans may be separated.
5 1 2 3 4 5
7
1 人解决,1 人已尝试。
1 份提交通过,共有 1 份提交。
8.9 EMB 奖励。