Tower Parking
Time Limit:1000MS |
|
Memory Limit:65536K |
|
|
|
Description
There is a new revolution in the parking lot business: the parking tower. The concept is simple: you drive your car into the elevator at the entrance of the tower, and the elevator and conveyor belts drag the car to an empty parking spot, where the car remains
until you pick it up. When you return, the elevator and conveyor belts move your car back to the entrance and you’re done.
The layout of the tower is simple. There is one central elevator that transports the cars between the different floors. On each floor there is one giant circular conveyor belt on which the cars stand. This belt can move in clockwise and counterclockwise
direction. When the elevator arrives on a floor, it becomes part of the belt so that cars can move through it.
At the end of the day the tower is usually packed with cars and a lot of people come to pick them up. Customers are processed in a first come first serve order: the elevator is moved to the floor of the first car, the conveyor belt moves the car on the elevator,
the elevator is moved down again, and so on. We like to know how long it takes before the last customer gets his car. Moving the elevator one floor up- or downwards takes 10 seconds and moving a conveyor belt one car in either direction takes 5 seconds.
Input
On the first line one positive number: the number of testcases, at most 100. After that per testcase:
-
One line with two integershandlwith 1 ≤h≤ 50 and 2 ≤l≤ 50: the height of the parking tower and the length of the conveyor belts.
-
hlines withlintegers: the initial placement of the cars. Thejth number on theith line describes thejth position on theith floor. This number is −1 if the position is empty, andrif the
position is occupied by therth car to pick up. The positive numbers form a consecutive sequence from 1 to the number of cars. The entrance is on the first floor and the elevator (which is initially empty) is in the first position. There is at least
one car in the parking tower.
Output
Per testcase:
- One line with the number of seconds before the last customer is served.
Sample Input
2
1 5
-1 2 1 -1 3
3 6
-1 5 6 -1 -1 3
-1 -1 7 -1 2 9
-1 10 4 1 8 -1
Sample Output
25
320
注意:本来是水题,可是理解错了,那个传送带是每层都有,所以每一层的传送带的距离都不同,层间没有关系,所以需要使用个数组存储,而不是只使用一个临时变量。
冋.....................而不是像下图所示的
由于以前看到过这样的视频,所以主观臆断
下面就是视频地址
http://www.tudou.com/programs/view/TH--UuxKx_s/
下面是AC代码
分享到:
相关推荐
poj 3632 Optimal Parking.md
POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类POJ分类
poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题报告poj 解题...
POJ第1861题源码 POJ第1861题源码 POJ第1861题源码
北大POJ1159-Palindrome 解题报告+AC代码
poj分类poj分类poj分类poj分类
poj 3414解题报告poj 3414解题报告poj 3414解题报告poj 3414解题报告
C语言 poj npu 西工大 C语言Poj答案全完整打包,给有需要的朋友
poj 1012解题报告poj 1012解题报告poj 1012解题报告poj 1012解题报告
poj 2329解题报告poj 2329解题报告poj 2329解题报告poj 2329解题报告
poj 1659解题报告poj 1659解题报告poj 1659解题报告poj 1659解题报告
POJ1503解答 POJ1503解答,正确答案(已通过POJ)
北大POJ2002-Squares 解题报告+AC代码
POJ1048,加强版的约瑟夫问题 难度中等
POJ1083的代码,POJ1083的代码,POJ1083的代码
poj 百练 题目分类 poj 百练 题目分类
poj 1001答案
POJ2968代码有用,欢迎下载,POJ代码
POJ上的一道题目,自己写的代码,因为想下载别人的, 所以就放上了。
poj 1440解题报告 poj 1440解题报告 poj 1440解题报告 poj 1440解题报告