B. 圆圆舞蹈

    Type: RemoteJudge 1000ms 125MiB

圆圆舞蹈

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

熊大妈的奶牛在时针的带领下,围成了一个圆圈,由于没有严格的教育,奶牛们之间的间隔不一致。

奶牛想知道两只最远的奶牛到底隔了多远。奶牛 AABB 的距离为 AA 顺时针走和逆时针走,到达 BB 的较短路程。告诉你相邻两个奶牛间的距离,请你求出两只最远的奶牛到底隔了多远。

输入格式

第一行一个整数 NN,表示有 NN 只奶牛,2N1052\le N\le 10^5

接下 2N+12\sim N+1 行,第 ii 行有一个数,表示第 i1i-1 头奶牛顺时针到第 ii 头奶牛的距离 did_i1di23111\le d_i\le 2^{31}-1,所有距离之和 2311\le 2^{31}-1

N+1N+1 行的数表示第 NN 头奶牛顺时针到第 11 头奶牛的距离。

输出格式

一行,表示最大距离。

5
1
2
3
4
5

7

20260914 队列

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2026-9-14 10:30
End at
2026-9-14 12:30
Duration
2 hour(s)
Host
Partic.
12