题面LateX 修缮+翻译补全
查看原帖
题面LateX 修缮+翻译补全
460020
mmr123楼主2023/11/12 18:15
	### 题目描述

	After several years of record milk production, Farmer John now operates an entire network of $N$ farms $(1 \leq N \leq 100)$. Farm $i$ is located at position $(x_i, y_i)$ in the 2D plane, distinct from all other farms, with both $x_i$ and $y_i$ being integers. FJ needs your help planning his daily delivery route to bring supplies to the $N$ farms. Starting from farm $1$, he plans to visit the farms sequentially (farm 1, then farm 2, then farm 3, etc.), finally returning to farm $1$ after visiting farm $N$. It tames FJ one minute to make a single step either north, south, east, or west. Furthermore, FJ wants to visit each farm exactly once during his entire journey (except farm $1$, which he visits twice of course). Please help FJ determine the minimum amount of time it will take him to complete his entire delivery route.

	### 输入格式

	- **Lines $1$:** The number of farms, $N$.

	- **Lines $2$ to $N + 1$:**  Line $i+1$ contains two space-separated integers, $x_i$ and $y_i$ $(1 \leq x_i, y_i \leq 10^6)$.

	### 输出格式

	- Line 1: The minimum number of minutes FJ needs to complete his delivery route, or $-1$ if it is impossible to find a feasible delivery route that visits every farm exactly once (except farm $1$).

	### 输入输出样例

	#### 输入 #1

	```textile
	4
	2 2
	2 4
	2 1
	1 3
	```

	#### 输出 #1

	```textile
	12
	```

	### 样例解释

	FJ can complete his delivery route in $12$ minutes: $2$ minutes to go from farm $1$ to farm $2$, $5$ minutes to go from farm $2$ to farm $3$ (circumventing farm 1), $3$ minutes to go from farm $3$ to farm $4$, and then $2$ minutes to return to farm $1$.

	## 题意翻译

	平面上有 $N$ 个点,其坐标均为整数,每个点被标上编号。一个人 $1$ 分钟可上下左右移动一个坐标单位。要求该人从第1点开始依次按编号访问第 $2$ 点、$3$ 点最后从第 $N$ 点回到第 $1$ 点,除第 $1$ 点外,每点只访问一次。求所需花的最少时间。

	##### 输入格式

	- 第 $1$ 行 $1$ 个整数, $N$。

	- 第 $2$ 到 $N + 1$ 行, 每行 $2$ 个整数 $(x_i,y_i)$描述一个农场的坐标。

	##### 输出格式

	- $1$ 行 $1$ 个整数, 完成行程的最小分钟数,无解请输出 $-1$。

题目描述

After several years of record milk production, Farmer John now operates an entire network of NN farms (1≤N≤100)(1 \leq N \leq 100). Farm ii is located at position (xi,yi)(x_i, y_i) in the 2D plane, distinct from all other farms, with both xix_i and yiy_i being integers. FJ needs your help planning his daily delivery route to bring supplies to the NN farms. Starting from farm 11, he plans to visit the farms sequentially (farm 1, then farm 2, then farm 3, etc.), finally returning to farm 11 after visiting farm NN. It tames FJ one minute to make a single step either north, south, east, or west. Furthermore, FJ wants to visit each farm exactly once during his entire journey (except farm 11, which he visits twice of course). Please help FJ determine the minimum amount of time it will take him to complete his entire delivery route.

输入格式

  • Lines 11: The number of farms, NN.

  • Lines 22 to N+1N + 1:  Line i+1i+1 contains two space-separated integers, xix_i and yiy_i (1≤xi,yi≤106)(1 \leq x_i, y_i \leq 10^6).

输出格式

  • Line 1: The minimum number of minutes FJ needs to complete his delivery route, or −1-1 if it is impossible to find a feasible delivery route that visits every farm exactly once (except farm 11).

输入输出样例

输入 #1

4
2 2
2 4
2 1
1 3

输出 #1

12

样例解释

FJ can complete his delivery route in 1212 minutes: 22 minutes to go from farm 11 to farm 22, 55 minutes to go from farm 22 to farm 33 (circumventing farm 1), 33 minutes to go from farm 33 to farm 44, and then 22 minutes to return to farm 11.

题意翻译

平面上有 NN 个点,其坐标均为整数,每个点被标上编号。一个人 11 分钟可上下左右移动一个坐标单位。要求该人从第1点开始依次按编号访问第 22 点、33 点最后从第 NN 点回到第 11 点,除第 11 点外,每点只访问一次。求所需花的最少时间。

输入格式
  • 第 11 行 11 个整数, NN。

  • 第 22 到 N+1N + 1 行, 每行 22 个整数 (xi,yi)(x_i,y_i)描述一个农场的坐标。

输出格式
  • 11 行 11 个整数, 完成行程的最小分钟数,无解请输出 −1-1。
2023/11/12 18:15
加载中...