21670_UncleHey

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

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

Pro.ID

21670

Title

Uncle Hey

Title链接

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

AC

4

Submit

5

Ratio

80.00%

时间&空间限制

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

    The annual GaoDaoKuOI (GDKOI), an interesting programming contest, was held several weeks ago. Uncle Hey had been supposed to be a judge, but turned out to be a scheduler, which annoyed him very much. What's going on?

    During the contest, contestants might want to go out for a break. (Don't ask why they have such a privilege. They do have anyway) However, it is not allowed that two or more contestants went out together. So, they had to go one by one, that is, First Come First Served. In case that two or more contestants posted their requests at the same time, you could safely assume that the one with the lexicographically smaller name came earlier.

    It's an annoying job, isn't it? So, Uncle Hey wants to share the annoyance with you guys here. Given the record of all requests like this:

    T1  C1  D1
    T2  C2  D2
    ...
    Tn  Cn  Dn

    Each line describes a request, where Ti represents the posting time of the request, and Ci represents the name of the contestant who posted the request, and Di means how long will it take for he/she to go out and come back. Note that, requests are given in no order.

    You're supposed to report all events like this: "xxx went out at time yyy" (quotes for clarity), where xxx represents the name of the contestant and yyy is the time when he/she was permitted to go. You should print the events in the non-decreasing order of the happening time. Please refer to the sample for more information.

    输入

    First line contains an integer M ( M ≤ 6 ), indicating the number of test cases.

    Each test case is in the format like this:

    First comes a positive integer N ( N ≤ 10000 ), indicating the number of requests.

    Then N lines follows. Each line contains a positive integer T, a string C and a positive integer D, representing a request. T ≤ 10000000,  D ≤ 1000,  C contains no more than 20 lowercase letters.

    It's guaranteed that there are no two requests share a same name.

    输出

    Description

    The annual GaoDaoKuOI (GDKOI), an interesting programming contest, was held several weeks ago. Uncle Hey had been supposed to be a judge, but turned out to be a scheduler, which annoyed him very much. What's going on?

    During the contest, contestants might want to go out for a break. (Don't ask why they have such a privilege. They do have anyway) However, it is not allowed that two or more contestants went out together. So, they had to go one by one, that is, First Come First Served. In case that two or more contestants posted their requests at the same time, you could safely assume that the one with the lexicographically smaller name came earlier.

    It's an annoying job, isn't it? So, Uncle Hey wants to share the annoyance with you guys here. Given the record of all requests like this:

    T1  C1  D1
    T2  C2  D2
    ...
    Tn  Cn  Dn

    Each line describes a request, where Ti represents the posting time of the request, and Ci represents the name of the contestant who posted the request, and Di means how long will it take for he/she to go out and come back. Note that, requests are given in no order.

    You're supposed to report all events like this: "xxx went out at time yyy" (quotes for clarity), where xxx represents the name of the contestant and yyy is the time when he/she was permitted to go. You should print the events in the non-decreasing order of the happening time. Please refer to the sample for more information.

    Input

    First line contains an integer M ( M ≤ 6 ), indicating the number of test cases.

    Each test case is in the format like this:

    First comes a positive integer N ( N ≤ 10000 ), indicating the number of requests.

    Then N lines follows. Each line contains a positive integer T, a string C and a positive integer D, representing a request. T ≤ 10000000,  D ≤ 1000,  C contains no more than 20 lowercase letters.

    It's guaranteed that there are no two requests share a same name.

    Output

    For each test case, print all events in the order described as above, one event per line. Print a blank line after each test case.

    Sample Input

    2
    1
    10 lq 5
    2
    10 lq 5
    5 wing 6

    Sample Output

    lq went out at time 10

    wing went out at time 5
    lq went out at time 11

    Source

    样例输入

    2
    1
    10 lq 5
    2
    10 lq 5
    5 wing 6

    样例输出

    lq went out at time 10

    wing went out at time 5
    lq went out at time 11

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部