問題一覧 > 通常問題

No.134 Run! Saburo-kun

レベル : / AI推定難易度 : 1125 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-7}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 160
作問者 : なお
お気に入りにしたユーザー ProblemId : 273 / 自分の提出
問題文最終更新日: 2026-06-28 19:25:15
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 80 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。