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

建议使用的浏览器:

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

2204:Commuter train

Special Judge 特殊评判
题目描述
You might have noticed that bus drivers sometimes pass by passengers waiting for the bus and stop at a place where the distance from the people to the bus doors is maximal. We don’t know exact reasonsof such behaviour, probably, this is done not because of some special wickedness of the driver but in order to allow passengers in the vehicle to get off quicker. However, we know that in one far-away countrythe government decided to implement automatic driving system on their commuter railroads. Amongother features, this system is intended to automatically stop commuter trains at stations. A computer in the train is connected to a special radar, which determines passenger positions at the station platform. The computer decides where to stop the train in order to maximize the sum of the distances from each passenger to the closest door. All the hardware is ready, but the software project is late (transport problems). Your task is to implement this function for this software project.
More precisely: The platform has length 0 < L <= 5000. There are 0 < M <= 300 passengers at the station platform. Each passenger p has position Pp (0 <= P1 <= ... <= PM <= L) — the distance from the platform beginning to the passenger. There are 0 < N <= 300 doors in the train. Each door d has position Dd (0 = D1 < D2 < ... < DN <= L) -- the distance from it to the door 1. The door width and the passenger sizes are not taken into account. For simplicity, you can assume that the distance between a passenger i and a train door j is dist(i, j, S) = |Dj + S - Pi|, where S is train position -- the distance between the first door and the beginning of the platform. Remember that the train must stop so that no door is outside of the platform.
输入解释
The input contains integer numbers, separated by spaces and/or line feeds. At the beginning of the file
there is the station description L, M, and P1 ... PM, followed by the train description N and D2 ... DN.
输出解释
You should output two numbers -- the train position S, at which the maximal possible sum of the minimal distances between the passengers and the doors can be achieved and the sum by itself. If there are many such train positions -- output any one.
输入样例
4
5
0 1 2 3 4
4
1 2 3
输出样例
0.5 2.5

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2204

最后修改于 2020-10-29T06:26:33+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536