QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 256 MB Puntuación total: 100

#12900. 观看

Estadísticas

澳大利亚有许多有趣的文化,例如各种体育运动和各种动物。你正试图观看在布里斯班的一条道路上举办的许多活动。

这条道路被分成了 $1\,000\,000\,000$ 个路段。路段从西向东编号为 $1, 2, \dots, 1\,000\,000\,000$。你想要观看 $N$ 个活动。第 $i$ 个活动将在第 $A_i$ 个路段举行。

为了观看这些活动,你准备了 $P$ 台小型摄像机和 $Q$ 台大型摄像机。你可以选择一个正整数 $w$ 作为拍摄参数。此时,一台小型摄像机最多可以拍摄 $w$ 个连续路段,而一台大型摄像机最多可以拍摄 $2w$ 个连续路段。一个路段可以被多台摄像机拍摄。你想要拍摄所有举办活动的区域。由于预计会有许多人参加这些活动,为了安全起见,你必须固定摄像机的位置,并且在活动期间不允许移动它们。参数 $w$ 越大,拍摄的成本就越高。因此,你想要最小化 $w$ 的值。

任务

编写一个程序,给定活动的信息和摄像机的数量,确定 $w$ 的最小值,使得所有举办活动的区域都能被拍摄到。

输入格式

从标准输入读取以下数据:

  • 第一行包含三个空格分隔的整数 $N, P, Q$,其中 $N$ 是活动数量,$P$ 是小型摄像机数量,$Q$ 是大型摄像机数量。
  • 接下来的 $N$ 行中的第 $i$ 行($1 \le i \le N$)包含一个整数 $A_i$,表示第 $i$ 个活动举办的路段。

输出格式

向标准输出打印 $w$ 的最小值,使得所有举办活动的区域都能被拍摄到。

数据范围

所有输入数据满足以下条件:

  • $1 \le N \le 2\,000$
  • $1 \le P \le 100\,000$
  • $1 \le Q \le 100\,000$
  • $1 \le A_i \le 1\,000\,000\,000$ ($1 \le i \le N$)

子任务

子任务 1 [50 分]

  • 满足 $N \le 100$。

子任务 2 [50 分]

  • 没有额外限制。

样例

样例输入 1

3 1 1
2
11
17

样例输出 1

4

说明:在此样例中,当你选择 $w = 4$ 时,可以拍摄到所有举办活动的区域。例如,你可以用一台小型摄像机拍摄第 $1$ 到 $3$ 路段,并用一台大型摄像机拍摄第 $11$ 到 $18$ 路段。

样例输入 2

13 3 2
33
66
99
10
83
68
19
83
93
53
15
66
75

样例输出 2

9

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.