当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3219:Jammed Traffic

题目描述
Finally, YY graduated from a little known university and got employed by a small company, with great effort. The job is interesting, well paid and nice in many
aspects, except for the company is a little far from home. So YY has to take bus to work every day early in the morning, and prays for no traffic jams along the road.

The route of the bus is fixed. It goes past N+1 landmarks one by one, the first of which is the bus-stop where YY gets on the bus, and the last is the company
where he should get off. If traffic jams do not occur, the time consumed to go between landmarks is also fixed — Ti minutes from ith landmark to (i+1)th
landmark (1≤i≤N). However, if a traffic jam is encountered, things are different. After having been late for many times (and luckily enough not been fired by his
boss & girlfriend LMY), YY has discovered that the road between two consecutive landmarks will be jammed only in a fixed time period in a day. If the bus is
between ith landmark and (i+1)th landmark (excluding at the two landmarks themselves) and encounters a traffic jam, additional Di minutes are needed to
get to (i+1)th landmark.

Given the time YY gets on the bus and the time his company start to work, could he reach the company in time?
输入解释
For each test case, the first line contains only one integer N. (1≤N≤100)
Then N lines follow. The ith line of which describes the road between ith landmark and (i+1)th landmark. Two integers comes first, Ti and Di (1≤Ti , Di≤60), indicating
the basic time consumption and additional time consumption with traffic jam for the bus to go between the two landmarks, in minutes. A pair of time Si and Ei follows,
in HH:MM format (24 hours), indicating the starting and ending time of traffic jam between the two landmarks. Si is always strictly earlier than Ei, and they are always
in the same day.

The last line contains the time when YY gets on the bus and the time when the company starts to work, in HH:MM format (24 hours). He must arrive at the company
strictly before it starts to work, or he is late.

All times are in the same day.
Input end with N=0.
输出解释
For each test case, output one line with string “Poor YY!” if he will definitely be late or output “Lucky YY!” if he will not. Quotes for clarity, do not output them.
输入样例
1
10 20 07:30 08:00
07:20 07:35
1
10 20 07:30 08:00
07:21 07:51
1
1 1 12:00 12:30
23:59 00:01
0
输出样例
Lucky YY!
Poor YY!
Poor YY!
提示
In the first test case, the bus starts at 07:20 and arrives at the company at 07:30, just avoids to be blocked by the traffic jam.

In the second test case, the bus start at 07:21 and encounters traffic jam at 07:30 when it is still on the way to the company. So additional 20 minutes are needed,
 and it arrives at the company at 07:51. So poor YY is just late, because he doesn’t reach the company before 07:51, when it starts to work.

In the third test case, the bus arrives at the company at 00:00 in the second day, so he is considered to be late for almost one entire day.
来自杭电HDUOJ的附加信息
Recommend zhuweicong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3219

最后修改于 2020-10-25T23:01:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)