C. Stairs and Elevators
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
In the year of 30XX30XX participants of some world programming championship live in a single large hotel. The hotel has nn floors. Each floor has mm sections with a single corridor connecting all of them. The sections are enumerated from 11 to mm along the corridor, and all sections with equal numbers on different floors are located exactly one above the other. Thus, the hotel can be represented as a rectangle of height nn and width mm. We can denote sections with pairs of integers (i,j)(i,j), where ii is the floor, and jj is the section number on the floor.
The guests can walk along the corridor on each floor, use stairs and elevators. Each stairs or elevator occupies all sections (1,x)(1,x), (2,x)(2,x), ……, (n,x

该博客讨论了在一个有楼梯和电梯的多层酒店建筑中,如何通过二分查找算法来快速找到从一个房间到另一个房间的最短路径。文章介绍了如何处理查询并计算在不同楼层间移动的最短时间,考虑了电梯的最大速度和楼梯的移动效率。
最低0.47元/天 解锁文章
394

被折叠的 条评论
为什么被折叠?



