#P7308. [COCI 2018/2019 #2] Preokret

[COCI 2018/2019 #2] Preokret

Description

Suppose we are watching a future ball game. The two teams are Team A and Team B. We know both teams' scores and the exact time of each scoring event. Within one second, it is impossible for more than one scoring event to happen.

King James wants answers to two questions:

  1. How many total points were scored in the first half? (The whole game lasts 4×124 \times 12 minutes.).
  2. How many lead changes happened? (A lead change is defined as when a team is behind, and then after scoring, its score becomes greater than the other team's score.).

Input Format

The first line contains a positive integer AA, which is Team A's total number of scoring events.

The next AA lines each contain a positive integer AsA_s, which is the time of Team A's ss-th score.

The next line contains a positive integer BB, which is Team B's total number of scoring events.

The next BB lines each contain a positive integer BsB_s, which is the time of Team B's ss-th score.

Output Format

Output two lines. Each line should contain the answer to the corresponding question in the statement.

3
10
1400
1500
2
7
2000
3
1
6
15
30
35
55
60
2065
7
20
25
40
45
50
2070
2075
10
5
11
1402
1412
1428
1430
1441
1444
1453
1483
1485
1489
1490
9
1403
1405
1409
1435
1459
1460
1461
1487
1495
8
2

Hint

Explanation for Sample 2

Score (A:B) Time (seconds) Half Lead change happened
1:01:0 1515 11 No.
1:11:1 2020
1:21:2 2525 Yes (B).
2:22:2 3030 No.
3:23:2 3535 Yes (A).
3:33:3 4040 No.
3:43:4 4545 Yes (B).
3:53:5 5050 No.
4:54:5 5555
5:55:5 6060
6:56:5 20652065 22 Yes (A).
6:66:6 20702070 No.
6:76:7 20752075 Yes (B).

Constraints

For 100%100\% of the testdata, 1A,B28791 \le A,B \le 2879, 1As,Bs28801 \le A_s,B_s \le 2880.

Scoring

In each test case, the first line is worth 22 points and the second line is worth 33 points, for a total of 55 points per test case.

Scoring requires a Special Judge. See the attachment for details.

Notes

This problem's score follows the original COCI setting, with a full score of 5050.

Translated from COCI2018-2019 CONTEST #2 T1 Preokret.

Translated by ChatGPT 5