QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 128 MB 満点: 100

#679. 时区

統計

你是一位商人,拥有遍布全球的客户。在一天之内,你从每个时区(包括你所在的区域)各收到恰好一条消息。消息中注明了发送时间(消息传输是瞬时的)。不幸的是,由于千年虫问题,发送者的本地时间没有包含任何标识其时区的信息。

任务

你的任务是确定这些消息分别来自哪个时区。

在此任务中,一天中的小时数 $n$ 在 $5 \dots 60$ 之间变化。时区的数量始终与一天中的小时数相同,且每个时区都有一个整数小时的时差。

时区编号为 $0$ 到 $n - 1$。你居住在“GMT”时区并在此接收消息,即时区 $0$,没有任何时差。时区向西计数。这意味着你需要将时区 $z$ 的本地时间加上 $z$ 小时,才能得到你所在时区的时间。注意,这与通常的时区计数方式不同,通常时区 $2$ 会被称为“-2:00”。

例如,如果时区 $2$ 的本地时间是 03:15,那么在你所在的时区(“GMT”)中就是 05:15。

消息可以在一天中的任何时间到达(即 0:00 到 $(n - 1):59$ 之间),但没有两条消息会在同一时间到达。日期变更线位于时区 $0$ 和最后一个时区之间,因此可以忽略。

输入格式

输入的第一行包含一天中的小时数 $n$($5 \le n \le 60$),这也是时区的数量以及你收到的消息数量。

接下来的 $n$ 行,每行包含以 hhmm 格式给出的本地发送时间(2 位小时数和 2 位分钟数,其中 $0 \le hh \le n - 1$ 且 $0 \le mm \le 59$)。这些行按到达时间的先后顺序排列,即第一行是第一条到达的消息。

所有给定的测试样例都有唯一的解。

输出格式

输出应包含一行,包含 $n$ 个 $0$ 到 $n - 1$ 之间的数字,标识这 $n$ 条消息分别来自哪个时区。第一个数字对应输入中给出的第一个时间,依此类推。

样例

输入格式 1

5
0017
0250
0400
0201
0002

输出格式 1

3 1 0 2 4

说明

注意,第 3 条消息必须来自时区 $0$,否则它到达的时间将晚于 4:59,而 4:59 在本例中是 5 小时制一天的最后一分钟。

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.