QOJ.ac

QOJ

حد الوقت: 0.25 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#10679. 最美风景

الإحصائيات

奥运会期间,巴黎的游客非常拥挤!你想逃离城市,去一条线性的步道上徒步,方向是从左到右。步道上每隔一公里(包括起点和终点)都有一个里程碑,上面写着该处的海拔高度。任意两个相邻里程碑之间的坡度是恒定的,且没有两个里程碑的海拔高度相同。

为了和朋友们重游此地,你试图找出徒步过程中风景最美的地方。一个点的风景美感定义为:从你当前位置向左看,能看到的与你当前海拔高度相同的最远位置,与你当前位置之间的距离(以公里为单位)。如果不存在这样的位置,则意味着你可以看到城市及其烟雾,此时该点的美感为零。

你已经列出了所有里程碑的海拔高度。请问你徒步过程中能获得的最大美感是多少?

输入格式

输入包含两行。第一行包含一个整数 $N$,表示步道上的里程碑数量。第二行包含 $N$ 个空格分隔的整数 $H_1, H_2, \dots, H_N$,其中每个整数 $H_k$ 表示路径上第 $k$ 个里程碑的海拔高度(以米为单位)。

输出格式

输出应包含一行,由一个数字 $S$ 组成:你徒步过程中能获得的最大美感分数。该数字可以写成整数,或者写成不可约分数 $N/D$(其中 $D \geqslant 2$);我们回顾一下,当 $N$ 和 $D$ 的最大公约数为 $1$ 时,分数 $N/D$ 是不可约的。

数据范围

  • $1 \leqslant N \leqslant 100\,000$;
  • $0 \leqslant H_k \leqslant 1\,000\,000$,对于所有 $k \leqslant N$;
  • 所有整数 $H_k$ 互不相同。

样例

样例输入 1

7
0 5 3 1 4 8 2

样例输出 1

13/4

样例输入 2

5
3 5 8 7 1

样例输出 2

0

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.