Xiao Fang sister school to go hiking

This is a story of a soul ha ha ha ha
finally, Zhang promised the small side, the two go together, come halfway up the mountain, he saw a store is doing activities in order to attract more customers to patronize, the boss who says 200 yuan in cash if you can challenge success in the shortest time possible to win, and recently played a small side needs peace elite recharge buy equipment, so the small side pulled clever Zhang challenge this game, the game content is that now there is only a small N pigs, at a speed of 1 meter per second in the bridge length L m of walking, because the bridge is too narrow, when the two pigs met, they can not be staggered by, each counter can go back. For each pig concerned, we know that the distance from the bridge to the left of Xi, but do not know its current orientation. Now you figure out all the pigs off the bridge required minimum time and maximum time to help small sister party won the 200 yuan in cash

Input format
length L m of the first line of the input bridge
of the second pig input line number N
of the third row are sequentially input from the i-th bridge piglets left distance Xi (X1, X2 ...... Xn)
output form
a first minimum time behavior minT
second longest maxT behavior
sample input 1
10
. 3
2. 6. 7
sample output 1
. 4
. 8
data size and convention
. 1 <= L <= 10 ^. 5
. 1 <= N <= 10 ^ . 5
0 <= Xi <= L

Guess you like

Origin www.cnblogs.com/dingchenyang/p/11667867.html