No.134 Run! Saburo-kun
タグ : / 解いたユーザー数 160
作問者 :
Problem Statement
Saburo-kun works at a liquor store and is about to deliver ordered goods by truck.
The liquor store, which is the starting point, and all delivery destinations are on a 2-dimensional plane, and their positions are as follows:
$(X_0,\ Y_0)$ are the coordinates of the liquor store, and the $N$ delivery destinations are represented by the coordinates $(X_i,\ Y_i)$. $(1 \leq i \leq N)$
At each delivery destination $i$, goods of weight $W_i$ are unloaded from the truck and handed over.
The roads in this town are laid out in a grid pattern,
and from each point you can move to any point in the north-south direction (Y-axis) or the east-west direction (X-axis). However,
when carrying a load of weight $W$, moving 1 unit of distance takes the time $T$ given by the following formula.
\[ T = \frac{W+100}{120} \]
In addition, unloading the load of weight $W_i$ at each delivery destination $i$ takes time $W_i$.
Find the minimum time required to load all the goods onto the truck at the liquor store, visit the delivery destinations,
finish delivering the goods to all delivery destinations, and return to the liquor store.
・The truck never carries anything other than the goods to be delivered.
・The truck never stops or slows down for any reason during movement, and keeps moving at a constant speed.
・The time for the initial loading of the goods is not included.
Input
$X_0$ $Y_0$ $N$ $X_1$ $Y_1$ $W_1$ $X_2$ $Y_2$ $W_2$ $\dots$ $X_i$ $Y_i$ $W_i$ $\dots$ $X_N$ $Y_N$ $W_N$
Line $1$ contains integers $X_0,\ Y_0$ representing the position of the liquor store.
Line $2$ contains an integer $N\ (1 \leq N \leq 13)$ representing the number of delivery destinations.
Each of the following $N$ lines contains, separated by spaces, integers $(X_i,\ Y_i)$ representing the position of a delivery destination and the weight of the goods to deliver, $W_i\ (1 \leq W_i \leq 100)$, given as a decimal with up to 6 decimal places or an integer. $(1 \leq i \leq N)$
The positions of the liquor store and the delivery destinations are all within the range $(0 \leq X_i,\ Y_i \leq 1000)$.
Output
Output the minimum time required until all the goods have been delivered.
An answer is accepted if at least one of its absolute error or relative error is at most \(10^{−7}\).
Sample
Sample 1
Input
0 0 3 100 178 100 23 25 40 34 31 90
Output
989.75
Starting from the liquor store and visiting delivery destination $2$, delivery destination $3$, and delivery destination $1$ in this order achieves delivery in the minimum time.
Sample 2
Input
0 0 5 0 0 100 0 0 100 0 0 100 0 0 100 0 1000 1
Output
2076
The liquor store and a delivery destination may be at the same position, and multiple delivery destinations may be at the same position.
No movement is needed for the $1$st through $4$th destinations, so unloading the goods takes a total of time $400$.
Next, delivering to the $5$th destination takes time $842.666667$, and adding the time $833.333333$ to return to the liquor store gives the answer.
Sample 3
Input
10 10 1 10 10 1.2
Output
1.2
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。