Uncle Hey
来源:互联网 发布:windows桌面整理软件 编辑:程序博客网 时间:2024/05/16 04:40
Problem 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 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:
T1C1D1
T2C2D2
……
TnCnDn
Each line describe a request, where T1 represents the posting time of the request, and C1 represents the name of the contestant who posted the request, and D1 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 non-decreasing order of the happending time. Please refer to the sample for more information.
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 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:
T1C1D1
T2C2D2
……
TnCnDn
Each line describe a request, where T1 represents the posting time of the request, and C1 represents the name of the contestant who posted the request, and D1 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 non-decreasing order of the happending 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 contain no more than 20 lowercase letters.
It's guaranteed that there are no two requests share a same name.(begini<endi<=32767)
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 contain no more than 20 lowercase letters.
It's guaranteed that there are no two requests share a same name.(begini<endi<=32767)
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
2110 lg 5210 lg 55 wing 6
Sample Output
lg went out at time 10wing went out at time 5lg went out at time 11
Author
代码:
0 0
- Uncle Hey
- Uncle Hey
- Uncle Hey
- Uncle Hey
- Uncle Hey
- Uncle Hey
- Uncle Hey
- J、Uncle Hey
- hey~
- hey!
- HEY
- Hey
- Hey Jude
- Hey Jude
- Hey Jude
- Hey jude
- hey jude
- Hey , TSALLY``
- IplImage, CvMat, Mat 的关系
- Ubuntu 14.04安装与配置
- zoj 3804 YY's Minions (ZOJ Monthly, August 2014 - G)
- nodejs 读取JSON文件写入txt中 fs.readFile&fs.writeFile
- MySQL的Master/Slave集群安装和配置
- Uncle Hey
- 智能博物馆文物管理系统产品介绍
- 什么是堆和栈,它们在哪
- 剑指Offer21包含min函数的栈
- 杭电 acm 1099
- iOS 表格
- 汽车主从动锥齿轮严重粘附磨损的诊断与排除
- Asp.net MVC 视图之公用代码
- wget设置代理