QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#3655. 列车乘降

Statistiques

Punctual City 以其市民和公共交通系统的准时性而闻名。它尤其以其列车系统而著称。列车总是准时到达,从不迟到(甚至从不早到)。为了保持系统平稳运行,有关列车上车情况的统计数据会定期收集。

列车有编号为 $1$ 到 $N$ 的车厢(从前到后),每节车厢长度为 $L$ 米。每节车厢在中心位置(距离车厢两端各 $L/2$ 米处)设有一个上车门。车厢之间没有间隙。

当列车停在站台上时,每位等待上车的乘客都会走到距离他们最近的车厢门处;如果距离相等,则选择编号较大的车厢。

给定乘客相对于列车的位置,请帮助该市计算出任何乘客需要步行的最长距离,以及单节车厢上车的乘客人数的最大值。

输入格式

输入的第一行包含三个整数 $N$ ($1 \le N \le 100$),表示列车的车厢数量;$L$ ($2 \le L \le 100$),表示每节车厢的长度;以及 $P$ ($1 \le P \le 1\,000$),表示等待上车的乘客人数。保证 $L$ 是一个偶数。

接下来的 $P$ 行描述了乘客相对于列车的位置。每行包含一个整数 $x$ ($0 \le x \le 10\,000$),表示乘客距离列车前端的距离。

输出格式

在第一行输出任何乘客需要步行的最长距离。在下一行输出单节车厢上车的乘客人数的最大值。

样例

样例输入 1

68 90 6
3809
288
2306
2215
4211
379

样例输出 1

27
1

样例输入 2

27 58 10
823
678
799
224
349
1002
308
978
602
265

样例输出 2

28
1

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.