QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 32 MB 總分: 100

#11872. 右旋骆驼

统计

Byteotia 由沙漠中的 $N$ 个绿洲组成,其中任意三点不共线。Byteasar 居住在其中一个绿洲,并且他与其余每个绿洲的人都相识。Byteasar 希望尽可能多地拜访这些朋友。他计划骑骆驼旅行。这头骆驼像骡子一样固执,因此它有自己独特的移动方式:

  • 从一个绿洲出发后,它沿直线移动,直到到达另一个绿洲。
  • 骆驼只在绿洲处转向,且只能向右(顺时针)转向,转角范围为 $[0^\circ, 180^\circ]$(骆驼在绿洲处只进行一次转向,即它不会通过两次 $100^\circ$ 的转向来实现 $200^\circ$ 的转向)。
  • 骆驼不想走回头路。

请帮助 Byteasar 规划一条路线,使他能够拜访尽可能多的朋友。路线必须以 Byteasar 居住的绿洲为起点和终点。路线由连接依次访问的绿洲的线段组成。除了 Byteasar 居住的绿洲外,路线不得经过任何点两次,而 Byteasar 的绿洲在旅程开始和结束时各经过一次。

Byteasar 的骆驼最初面向某个绿洲,并且必须开始向该方向移动。旅程结束后骆驼面向的方向无关紧要。

编写一个程序:

  • 从标准输入读取绿洲的坐标、骆驼初始面向的方向以及 Byteasar 居住的绿洲坐标,
  • 确定在遵守上述规则的情况下,Byteasar 最多能拜访的朋友数量,
  • 将结果写入标准输出。

输入格式

标准输入的第一行包含一个整数 $N$ ($3 \le N \le 1\,000$),表示 Byteotia 的绿洲数量。绿洲编号从 $1$ 到 $N$。Byteasar 住在 $1$ 号绿洲,他的骆驼初始面向 $2$ 号绿洲。接下来的 $N$ 行给出了绿洲的坐标。第 $(i+1)$ 行包含两个整数 $x_i, y_i$,即第 $i$ 个绿洲的横坐标和纵坐标,中间用空格隔开。所有坐标均在 $-16\,000$ 到 $16\,000$ 之间。

输出格式

在标准输出的第一行(也是唯一一行)中,输出一个整数,表示 Byteasar 最多能拜访的朋友数量。

样例

输入 1

6
1 1
-1 4
0 -1
4 1
0 3
1 4

输出 1

4

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.