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

建议使用的浏览器:

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

1386:Elevator Simulation

题目描述
You are to simulate the movements of an elevator, which works according to the following rules:
The elevator stays 3 seconds for customers to get in or get out. If some customers want to get in and some want to get out, the elevator stays 6 seconds.

It takes the elevator 2 seconds to go one story upwards or downwards.

When there is no request for service, the elevator stays where it is. Namely, it is idle.

When the elevator is idle, and a request comes from upwards or downwards, it moves upwards or downwards. If a request comes from the story where it stays, the elevator opens its door to serve these customers.

When the elevator goes upwards or downwards, it keeps its direction until there is no request from upwards or downwards. However, it breaks off to let customers get out or pick up customers if necessary.

If the elevator is to go upwards or downwards, it does not accept customers intending to go upwards or downwards.

When the elevator can act more than one way according to aforementioned rules, it chooses the action with the highest priority. The priorities for actions, from the highest to the lowest, are:

let customers get out

let customers get in

go downstairs

go upstairs

Initially (at time 0), the elevator is in the 0th story, and it is idle. Given the requests, you are to output how the elevator moves in a designated interval. Suppose that each request comes at an integer second.

输入解释
The input begins in its first line with the number of stories of a building, and other two numbers representing an interval. These three numbers are separated by a blank.

Each of the following lines in the input consists of three numbers, N1, N2, and N3, representing a request coming from N2th story to N3th story at time N1.

A line of three 0's separates two test cases. After the last test case, there is a line containing three 0's.

输出解释
You have to output what the elevator acts at each second in the designated interval. Behind each case should be one blank line
输入样例
5 9 67
10 2 1
13 2 4
21 4 2
26 4 3
40 1 2
45 0 3
46 0 2
0 0 0
0 0 0
输出样例
9: Idle at story 0
10: Going up to 1
11: Going up to 1
12: Going up to 2
13: Going up to 2
14: Let upstair-customers get in at story 2
15: Let upstair-customers get in at story 2
16: Let upstair-customers get in at story 2
17: Going up to 3
18: Going up to 3
19: Going up to 4
20: Going up to 4
21: Let customers get out at story 4
22: Let customers get out at story 4
23: Let customers get out at story 4
24: Let downstair-customers get in at story 4
25: Let downstair-customers get in at story 4
26: Let downstair-customers get in at story 4
27: Going down to 3
28: Going down to 3
29: Let customers get out at story 3
30: Let customers get out at story 3
31: Let customers get out at story 3
32: Going down to 2
33: Going down to 2
34: Let customers get out at story 2
35: Let customers get out at story 2
36: Let customers get out at story 2
37: Let downstair-customers get in at story 2
38: Let downstair-customers get in at story 2
39: Let downstair-customers get in at story 2
40: Going down to 1
41: Going down to 1
42: Let customers get out at story 1
43: Let customers get out at story 1
44: Let customers get out at story 1
45: Going down to 0
46: Going down to 0
47: Let upstair-customers get in at story 0
48: Let upstair-customers get in at story 0
49: Let upstair-customers get in at story 0
50: Going up to 1
51: Going up to 1
52: Let upstair-customers get in at story 1
53: Let upstair-customers get in at story 1
54: Let upstair-customers get in at story 1
55: Going up to 2
56: Going up to 2
57: Let customers get out at story 2
58: Let customers get out at story 2
59: Let customers get out at story 2
60: Going up to 3
61: Going up to 3
62: Let customers get out at story 3
63: Let customers get out at story 3
64: Let customers get out at story 3
65: Idle at story 3
66: Idle at story 3
67: Idle at story 3
来自杭电HDUOJ的附加信息
Recommend Eddy

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

源链接: HDU-1386

最后修改于 2020-10-25T22:44:30+00:00 由爬虫自动更新

共提交 231

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