#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:
- How many total points were scored in the first half? (The whole game lasts minutes.).
- 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 , which is Team A's total number of scoring events.
The next lines each contain a positive integer , which is the time of Team A's -th score.
The next line contains a positive integer , which is Team B's total number of scoring events.
The next lines each contain a positive integer , which is the time of Team B's -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 |
|---|---|---|---|
| No. | |||
| Yes (B). | |||
| No. | |||
| Yes (A). | |||
| No. | |||
| Yes (B). | |||
| No. | |||
| Yes (A). | |||
| No. | |||
| Yes (B). |
Constraints
For of the testdata, , .
Scoring
In each test case, the first line is worth points and the second line is worth points, for a total of 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 .
Translated from COCI2018-2019 CONTEST #2 T1 Preokret.
Translated by ChatGPT 5
京公网安备 11011102002149号