CF939C.Convenient For Everybody

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In distant future on Earth day lasts for nn hours and that's why there are nn timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 11 to nn are used, i.e. there is no time "0 hours", instead of it " nn hours" is used. When local time in the 11 -st timezone is 11 hour, local time in the ii -th timezone is ii 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 aia_{i} people from ii -th timezone who want to participate in the contest. Each person will participate if and only if the contest starts no earlier than ss hours 00 minutes local time and ends not later than ff hours 00 minutes local time. Values ss and ff are equal for all time zones. If the contest starts at ff 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 nn ( 2<=n<=1000002<=n<=100000 ) — the number of hours in day.

The second line contains nn space-separated integers a1a_{1} , a2a_{2} , ..., ana_{n} ( 1<=ai<=100001<=a_{i}<=10000 ), where aia_{i} is the number of people in the ii -th timezone who want to participate in the contest.

The third line contains two space-separated integers ss and ff ( 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
    

说明/提示

In the first example, it's optimal to start competition at 33 hours (in first timezone). In this case, it will be 11 hour in the second timezone and 22 hours in the third timezone. Only one person from the first timezone won't participate.

In second example only people from the third and the fourth timezones will participate.

首页