QOJ.ac

QOJ

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

#8867. 相等的时间表

الإحصائيات

你是高可用性服务的值班人员之一,该服务为用户提供编程任务解答。作为一个有组织的团队,你们有一份值班表,规定了谁在什么时间负责该服务。一位同事发给你一份新的值班表,你想要确保每个人承担的值班时长与之前相同,或者打印出任何差异。

值班表由形式为 $s_i \ e_i \ t_i$ 的行指定,其中 $s_i$ 和 $e_i$ 表示队友 $t_i$ 从某个起始小时开始的值班轮次的开始和结束偏移量。

给定一个示例值班表:

0 7 jan
7 14 tomaz
14 20 jure
20 24 jan
24 25 tomaz
25 26 jure

我们可以看到 jan 在前 7 个小时(第 0, 1, 2, 3, 4, 5 和 6 小时)值班,tomaz 在接下来的 7 个小时值班,以此类推。总计 jan 值班 11 小时,tomaz 值班 8 小时,jure 值班 7 小时。

输入格式

输入包含两份值班表,由一条横线 ------ 分隔。每份值班表包含一行或多行形式为 $s_i \ e_i \ t_i$ 的数据,其中整数 $s_i$ 和 $e_i$ 指定队友 $t_i$ 在从 $s_i$ 到 $e_i$(不含 $e_i$)的时间段内值班。第二份值班表后会打印一行 ======

数据范围

对于每份值班表,满足以下条件:

  • $s_1 = 0$
  • $s_i < e_i$
  • $s_{i+1} = e_i$
  • $e_i \le 1000$
  • 名字 $t_i$ 由小写英文字母组成。
  • $3 \le |t_i| \le 20$

输出格式

输出两份值班表之间的差异,格式为 $t_i \ \pm d_i$,其中 $d_i$ 是队友 $t_i$ 在第二份值班表与第一份值班表之间的时长差。输出应按队友名字的字母顺序排序,没有差异的队友应被省略;否则,差异应带有 +- 号打印。如果没有发现差异,打印 “No differences found.”(不含引号)。

样例

样例 1

0 7 jan
7 14 tomaz
14 20 jure
20 24 jan
24 25 tomaz
25 26 jure
------
0 9 tomaz
9 20 jan
20 26 jure
======
jure -1
tomaz +1

样例 2

0 7 nino
7 14 bgs
14 21 ines
------
0 7 ines
7 14 nino
14 21 bgs
======
No differences found.

样例 3

0 3 vid
3 6 maks
6 9 janez
------
0 1 vid
1 2 vid
2 3 vid
3 4 maks
4 5 maks
5 6 maks
6 7 janez
7 8 janez
======
janez -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.