QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 64 MB 満点: 50

#13568. Preokret

統計

如果继续这样打下去,世界上最好的篮球联赛 NBA 的球员们很快就会每秒都把球投进篮筐。这样一来,防守、战术和篮球本身都将不复存在。让我们想象一下观看未来 A 队和 B 队之间的一场比赛。我们知道 A 队和 B 队各自得了多少分,以及得分的具体秒数。在一秒钟内,不可能得到超过一分。

詹姆斯国王(King James)正在观察任务输入,并希望回答以下两个问题:

  1. 在上半场(即比赛的前半场)一共得了多少分?已知整场比赛持续 $4 \times 12$ 分钟。
  2. 比赛中发生了多少次“反超”(turnarounds)?即有多少次一支队伍从落后状态(得分严格少于另一队)变为领先状态(得分严格多于另一队)?

输入格式

第一行包含一个正整数 $A$ ($1 \le A \le 2879$),表示 A 队的得分数。

接下来的 $A$ 行中包含正整数 $A_s$ ($1 \le A_s \le 2880$),表示 A 队得分的秒数,按从小到大的顺序排列。

在第 $(A + 2)$ 行中包含一个正整数 $B$ ($1 \le B \le 2879$),表示 B 队的得分数。

接下来的 $B$ 行中包含正整数 $B_s$ ($1 \le B_s \le 2880$),表示 B 队得分的秒数,按从小到大的顺序排列。

输出格式

第一行输出一个整数,表示任务文本中第一个问题的答案。

第二行输出一个整数,表示任务文本中第二个问题的答案。

子任务

第一行的正确输出价值 2 分,第二行的正确输出价值 3 分。如果您不知道如何解决任务的某一部分,请在相应的行中打印任何内容。

样例

输入样例 1

3
10
1400
1500
2
7
2000

输出样例 1

3
1

输入样例 2

6
15
30
35
55
60
2065
7
20
25
40
45
50
2070
2075

输出样例 2

10
5

输入样例 3

11
1402
1412
1428
1430
1441
1444
1453
1483
1485
1489
1490
9
1403
1405
1409
1435
1459
1460
1461
1487
1495

输出样例 3

8
2

说明

第二个样例的解释:

比分变化 “A队 : B队” 反超 (是/否)
1:0 (第 15 秒,上半场)
1:1 (第 20 秒,上半场)
1:2 (第 25 秒,上半场) 是 (B队)
2:2 (第 30 秒,上半场)
3:2 (第 35 秒,上半场) 是 (A队)
3:3 (第 40 秒,上半场)
3:4 (第 45 秒,上半场) 是 (B队)
3:5 (第 50 秒,上半场)
4:5 (第 55 秒,上半场)
5:5 (第 60 秒,上半场)
6:5 (第 2065 秒,下半场) 是 (A队)
6:6 (第 2070 秒,下半场)
6:7 (第 2075 秒,下半场) 是 (B队)

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.