CF357A.Group of Students

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

At the beginning of the school year Berland State University starts two city school programming groups, for beginners and for intermediate coders. The children were tested in order to sort them into groups. According to the results, each student got some score from 1 to mm points. We know that c1c_{1} schoolchildren got 1 point, c2c_{2} children got 2 points, ..., cmc_{m} children got mm points. Now you need to set the passing rate kk (integer from 1 to mm ): all schoolchildren who got less than kk points go to the beginner group and those who get at strictly least kk points go to the intermediate group. We know that if the size of a group is more than yy , then the university won't find a room for them. We also know that if a group has less than xx schoolchildren, then it is too small and there's no point in having classes with it. So, you need to split all schoolchildren into two groups so that the size of each group was from xx to yy , inclusive.

Help the university pick the passing rate in a way that meets these requirements.

输入格式

The first line contains integer mm ( 2<=m<=1002<=m<=100 ). The second line contains mm integers c1c_{1} , c2c_{2} , ..., cmc_{m} , separated by single spaces ( 0<=ci<=1000<=c_{i}<=100 ). The third line contains two space-separated integers xx and yy ( 1<=x<=y<=100001<=x<=y<=10000 ). At least one cic_{i} is greater than 0.

输出格式

If it is impossible to pick a passing rate in a way that makes the size of each resulting groups at least xx and at most yy , print 0. Otherwise, print an integer from 1 to mm — the passing rate you'd like to suggest. If there are multiple possible answers, print any of them.

输入输出样例

  • 输入#1

    5
    3 4 3 2 1
    6 8
    

    输出#1

    3
    
  • 输入#2

    5
    0 3 3 4 2
    3 10
    

    输出#2

    4
    
  • 输入#3

    2
    2 5
    3 6
    

    输出#3

    0
    

说明/提示

In the first sample the beginner group has 7 students, the intermediate group has 6 of them.

In the second sample another correct answer is 3.

首页