QOJ.ac

QOJ

Puntuación total: 100 Solo salida

#3092. 特技飞行

Estadísticas

Bitaro 将参加一场特技飞行比赛。在比赛中,Bitaro 将驾驶一架飞机。飞机将保持一定高度,并穿过各个检查点。飞机飞行的区域被视为一个坐标平面。共有 $N$ 个检查点,编号从 $1$ 到 $N$。检查点 $i$ ($1 \le i \le N$) 的坐标为 $(X_i, Y_i)$。

在比赛期间,飞机必须经过每个检查点恰好一次。更具体地说,飞机的飞行方式如下:

  1. 首先,Bitaro 选择起始检查点,飞机从该点开始飞行。
  2. 重复以下步骤 $N - 1$ 次: 在尚未选择的检查点中,Bitaro 选择一个检查点作为下一个检查点。然后,飞机将从当前检查点直线飞行到下一个检查点。
  3. 当飞机到达最后一个检查点时,飞行结束。

这里,在第 2 步中,我们将起始检查点视为已选择的检查点。飞机必须从一个检查点直线飞行到下一个检查点。禁止在途中画曲线或转弯。

飞机的航线是一条折线。在飞行过程中,飞机最多会改变 $N-2$ 次方向。如果折线在某个检查点处的角度较小,则飞机在该检查点处的方向改变较大,且存在飞行失败的风险。

因此,Bitaro 希望使除起始检查点和最后一个检查点之外的 $N-2$ 个检查点处折线的最小角度尽可能大。

给定检查点的坐标,请找到一种通过检查点的顺序,使得折线的最小角度尽可能大。

输入格式

输入数据按以下格式给出。所有给定值均为整数。其中 $Z_0$ 是评分器使用的参数。

$N \ Z_0$ $X_1 \ Y_1$ $\vdots$ $X_N \ Y_N$

输出格式

输出应包含 $N$ 行。输出的第 $k$ 行 ($1 \le k \le N$) 应包含整数 $P_k$ ($1 \le P_k \le N$),表示航线中的第 $k$ 个检查点。这里,起始检查点是第一个检查点 $P_1$。

提交说明

对于每个输入文件 input_01.txt, input_02.txt, ..., input_06.txt,请提交对应的输出数据 output_01.txt, output_02.txt, ..., output_06.txt

数据范围

  • $3 \le N \le 1\,000$。
  • $\sqrt{X_i^2 + Y_i^2} \le 10\,000\,000$ ($1 \le i \le N$)。
  • $(X_i, Y_i) \neq (X_j, Y_j)$ ($1 \le i < j \le N$)。
  • $1 \le Z_0 \le 179$。

实现细节

在本任务中,你可以使用库中包含的计算三点所成角度的函数。该库包含在存档文件中的 aerobatics.h 内。其规范如下:

  • double GetAngle(int xa, int ya, int xb, int yb, int xc, int yc)

此函数计算角度 $\angle BAC$(单位为度)。它返回一个误差足够小的实数。请确保参数顺序正确:

  • 关于点 $A$,参数 xa 是点 $A$ 的 $x$ 坐标,参数 ya 是点 $A$ 的 $y$ 坐标。
  • 关于点 $B$,参数 xb 是点 $B$ 的 $x$ 坐标,参数 yb 是点 $B$ 的 $y$ 坐标。
  • 关于点 $C$,参数 xc 是点 $C$ 的 $x$ 坐标,参数 yc 是点 $C$ 的 $y$ 坐标。
  • 如果点 $A, B$ 的坐标相同,或者点 $A, C$ 的坐标相同,则此函数的行为未定义。

在计算本任务解的程序中,你可以使用库中的 GetAngle 函数。如果你使用了它,你可以修改该函数。GetAngle 与评分器使用的函数相同。

评分

对于每个输出数据,你的得分计算方式如下:

如果你的输出不正确,得分为 0。例如,如果输出序列 $P_1, P_2, \dots, P_N$ 不是 $1, 2, \dots, N$ 的排列,或者输出格式不正确,则得分为 0。

如果你的输出正确,得分计算如下:令 $Z$(度)为除起始检查点和最后一个检查点之外的 $N-2$ 个检查点处折线的最小角度。那么你的得分 $S$ 按以下公式计算:

  • 如果 $Z \ge Z_0$,你的得分为 $S$。
  • 如果 $Z < Z_0$,你的得分为 $S \times \frac{f(Z/180)}{f(Z_0/180)}$。

这里函数 $f(\alpha)$ ($0 \le \alpha \le 1$) 定义为: $$f(\alpha) = 4\alpha^4 + \alpha$$

你在此任务中的总得分为 6 个输入数据的得分之和,四舍五入到最接近的整数。

对于每个输入数据,$N, Z_0$ 的值及满分分值如下表所示:

子任务 输入数据 $N$ $Z_0$ 分值
1 input_01.txt 15 100 10
2 input_02.txt 200 143 15
3 input_03.txt 200 134 15
4 input_04.txt 1000 156 20
5 input_05.txt 1000 150 20
6 input_06.txt 1000 153 20

样例

样例输入 1

7 90
3 1
2 5
0 2
-1 6
-3 1
-1 -4
4 -2

样例输出 1

5
3
1
7
6
4
2

说明

如果飞机按 5, 3, 1, 7, 6, 4, 2 的顺序通过检查点,飞机的航线如下图所示。角度最小的检查点是检查点 6,其角度约为 $68.19859\dots$ 度。由于 $Z_0 = 90$ 度,该输出的得分约为该输入数据满分的 $61.5\%$。


o sube archivos uno por uno:

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.