Logo
(追記) (追記ここまで)

8014번 - Island 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB1711861.538%

문제

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.

Write a program which:

  • reads from the standard input the description of the island,
  • computes the maximal distance the fans of one team may be separated from the fans of the other team,
  • writes the result to the standard output.

입력

In the first line of the standard input 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 of the standard output should contain one integer being the maximal distance the fans may be separated.

제한

예제 입력 1

5
1
2
3
4
5

예제 출력 1

7

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 2001/2002 > Stage 1 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /