21506_Booklets

2022-5-16 18:19| 发布者: Hocassian| 查看: 57| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505349370200-Problem List-采集的数据-后羿采集器.html

Pro.ID

21506

Title

Booklets

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21506

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Bob has a difficult job. He must distribute advertising booklets for extra school activities in different schools. The booklets have different number of pages. Bob has a list with the number of pages of each booklet and the number of schools that he must visit. He has to distribute the booklets such that each school gets a number of booklets equal to either the lower integer part (LIP), or the upper integer part (UIP) of the number of booklets divided by the number of schools. Poor Bob must obey other rules too. He must distribute all the UIP number of booklets first and then the LIP number of booklets. Any bookflet A that is distributed to a school Si must have fewer or at most an equal number of pages that any other booklet B that is distributed to a school Sj, if Si gets the booklets before Sj (i.e if i < j then pages(A) ≤ pages(B)). When Bob distributes the booklets to a school he must distribute them in the same relative order in which they are on his list. Moreover, he must distribute them very fast. When he comes back to the advertising company his boss verifies if he accomplished well his task, by asking him the number of pages of the first booklet distributed to a specific school, following the order in which Bob visited the schools (starting with 0). Difficult job, isn't it? Can you help him?

    输入

    Each data set in the input stands for a particular set of bookets. For each set of booklets the input contains the number of schools, the school specified by Bob's boss, the number of booklets (less than 3000), the number of pages of each booklet (fits in integer). White spaces can occur freely between the numbers in the input.The input data are correct.

    输出

    Description

    Bob has a difficult job. He must distribute advertising booklets for extra school activities in different schools. The booklets have different number of pages. Bob has a list with the number of pages of each booklet and the number of schools that he must visit. He has to distribute the booklets such that each school gets a number of booklets equal to either the lower integer part (LIP), or the upper integer part (UIP) of the number of booklets divided by the number of schools. Poor Bob must obey other rules too. He must distribute all the UIP number of booklets first and then the LIP number of booklets. Any bookflet A that is distributed to a school Si must have fewer or at most an equal number of pages that any other booklet B that is distributed to a school Sj, if Si gets the booklets before Sj (i.e if i < j then pages(A) ≤ pages(B)). When Bob distributes the booklets to a school he must distribute them in the same relative order in which they are on his list. Moreover, he must distribute them very fast. When he comes back to the advertising company his boss verifies if he accomplished well his task, by asking him the number of pages of the first booklet distributed to a specific school, following the order in which Bob visited the schools (starting with 0). Difficult job, isn't it? Can you help him?

    Input

    Each data set in the input stands for a particular set of bookets. For each set of booklets the input contains the number of schools, the school specified by Bob's boss, the number of booklets (less than 3000), the number of pages of each booklet (fits in integer). White spaces can occur freely between the numbers in the input.The input data are correct.

    Output

    For each set of data the program prints the result to the standard output on a separate line. The solution is represented by thenumber of pages of the first booklet distributed to the specified school.

    Sample Input

    3
    2
    7
    3 5 9 1 11 14 2

    Sample Output

    11

    Source

    样例输入

    3
    2
    7
    3 5 9 1 11 14 2

    样例输出

    11

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部