1375_PoorcontestantProb

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

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

Pro.ID

1375

Title

Poor contestant Prob

Title链接

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

AC

5

Submit

14

Ratio

35.71%

时间&空间限制

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

    As everybody known, "BG meeting" is very very popular in the ACM training team of ZSU.

    After each online contest, they will go out for "smoking". Who will be the poor ones that have to BG the others? Of course, the half who solve less problems.

    The rule runs well when the number of the contestants is even. But if the number is odd, it is impossible to divide them into two equal parts. It gives a dilemma to the BG meeting committee. After a careful discussion with Mr. Guo, a new rule emerged: if the number of the contestant is odd, the committee will first sort the contestants according to the number of problems they solved, and then they will pick out the middle one. This poor boy or girl will have no chance to attend the BG meeting.

    Strange rule, isn't it?

    As the number of the contestants is becoming more and more large, the committee need to write a program which will pick out the poor one efficiently.

    Note that: Every contestant solves different number of problems. The total number of the contestants will not exceed 105.

    输入

    There are several cases in the input. The first line of the input will be an integer M, the number of the cases.

    Each case is consisted of a list of commands. There are 3 types of commands.

    1. Add xxx n : add a record to the data base, where xxx is the name of the contestant, which is only consisted of at most 10 letters or digits, n is the number of problems he/she solved. (Each name will appear in Add commands only once).

    2. Query :

    3. End :End of the case.

    输出

    Description

    As everybody known, "BG meeting" is very very popular in the ACM training team of ZSU.

    After each online contest, they will go out for "smoking". Who will be the poor ones that have to BG the others? Of course, the half who solve less problems.

    The rule runs well when the number of the contestants is even. But if the number is odd, it is impossible to divide them into two equal parts. It gives a dilemma to the BG meeting committee. After a careful discussion with Mr. Guo, a new rule emerged: if the number of the contestant is odd, the committee will first sort the contestants according to the number of problems they solved, and then they will pick out the middle one. This poor boy or girl will have no chance to attend the BG meeting.

    Strange rule, isn't it?

    As the number of the contestants is becoming more and more large, the committee need to write a program which will pick out the poor one efficiently.

    Note that: Every contestant solves different number of problems. The total number of the contestants will not exceed 105.

    Input

    There are several cases in the input. The first line of the input will be an integer M, the number of the cases.

    Each case is consisted of a list of commands. There are 3 types of commands.

    1. Add xxx n : add a record to the data base, where xxx is the name of the contestant, which is only consisted of at most 10 letters or digits, n is the number of problems he/she solved. (Each name will appear in Add commands only once).

    2. Query :

    3. End :End of the case.

    Output

    1. For the Query command: If the current number of contestants is odd, the program should output the poor contestant's name currently even if there is only one contestants, otherwise, just out put "No one!" (without quotes).

    2. For the End command:    If the total number of contestants in the data base is even, you should out put "Happy BG meeting!!" (without quotes), otherwise, you should out put the "xxx is so poor." (without quotes) where xxx is the name of the poor one.

    3. Each case should be separated by a blank line.

    Sample Input

    2
    Add Magicpig 100
    Add Radium 600
    Add Kingfkong 300
    Add Dynamic 700
    Query
    Add Axing 400
    Query
    Add Inkfish 1000
    Add Carp 800
    End

    Add Radium 100
    Add Magicpig 200
    End

    Sample Output

    No one!
    Axing
    Radium is so poor.

    Happy BG meeting!!

    样例输入

    2
    Add Magicpig 100
    Add Radium 600
    Add Kingfkong 300
    Add Dynamic 700
    Query
    Add Axing 400
    Query
    Add Inkfish 1000
    Add Carp 800
    End

    Add Radium 100
    Add Magicpig 200
    End

    样例输出

    No one!
    Axing
    Radium is so poor.

    Happy BG meeting!!

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部