304947: CF939C. Convenient For Everybody
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Convenient For Everybody
题意翻译
在未来的世界有$n$个时区,也就是一天有$n$个小时。现在要举办一场持续$1$小时的比赛,开始时间与某个小时的开始时间一致。 在第$i$时区,有$a[i]$人参赛。 来自一个时区的人只会参加开始时间不早于当地时间$s$小时,结束时间不晚于当地时间$f$小时的比赛。 求出可以使得参赛人数最多的时间。 第一行,输入一个整数$n$($2\leq n \leq 100000$)。 第二行,输入$n$个整数($1 \leq a_i \leq10000$)。 第三行,输入两个整数,$s$和$f$。题目描述
In distant future on Earth day lasts for $ n $ hours and that's why there are $ n $ timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from $ 1 $ to $ n $ are used, i.e. there is no time "0 hours", instead of it " $ n $ hours" is used. When local time in the $ 1 $ -st timezone is $ 1 $ hour, local time in the $ i $ -th timezone is $ i $ hours. Some online programming contests platform wants to conduct a contest that lasts for an hour in such a way that its beginning coincides with beginning of some hour (in all time zones). The platform knows, that there are $ a_{i} $ people from $ i $ -th timezone who want to participate in the contest. Each person will participate if and only if the contest starts no earlier than $ s $ hours 00 minutes local time and ends not later than $ f $ hours 00 minutes local time. Values $ s $ and $ f $ are equal for all time zones. If the contest starts at $ f $ hours 00 minutes local time, the person won't participate in it. Help platform select such an hour, that the number of people who will participate in the contest is maximum.输入输出格式
输入格式
The first line contains a single integer $ n $ ( $ 2<=n<=100000 $ ) — the number of hours in day. The second line contains $ n $ space-separated integers $ a_{1} $ , $ a_{2} $ , ..., $ a_{n} $ ( $ 1<=a_{i}<=10000 $ ), where $ a_{i} $ is the number of people in the $ i $ -th timezone who want to participate in the contest. The third line contains two space-separated integers $ s $ and $ f $ ( $ 1<=s<f<=n $ ).
输出格式
Output a single integer — the time of the beginning of the contest (in the first timezone local time), such that the number of participants will be maximum possible. If there are many answers, output the smallest among them.
输入输出样例
输入样例 #1
3
1 2 3
1 3
输出样例 #1
3
输入样例 #2
5
1 2 3 4 1
1 3
输出样例 #2
4