题目描述
Problem Description
Suppose we are watching a future ball game where the competing teams are Team A and Team B. We know the scores of both teams and the exact times of each score. It is impossible to score more than once in a second.
King James wants to know the answers to two questions:
- How many points were scored in the first half? (The entire game lasts $4 \times 12$ minutes)
- How many times did a team overtake the other? (An overtake is defined as a team scoring after being behind and then leading)
Input Format
The first line contains a positive integer $A$, representing the number of points scored by Team A.
The next $A$ lines each contain a positive integer $A_s$, representing the time of Team A's $s$-th score.
The next line contains a positive integer $B$, representing the number of points scored by Team B.
The next $B$ lines each contain a positive integer $B_s$, representing the time of Team B's $s$-th score.
Output Format
Output two lines, each containing the answer to the corresponding question in the problem description.
Sample Input and Output
Sample Input #1
3
10
1400
1500
2
7
2000
Sample Output #1
3
1
Sample Input #2
6
15
30
35
55
60
2065
7
20
25
40
45
50
2070
2075
Sample Output #2
10
5
Sample Input #3
11
1402
1412
1428
1430
1441
1444
1453
1483
1485
1489
1490
9
1403
1405
1409
1435
1459
1460
1461
1487
1495
Sample Output #3
8
2
Notes
Sample 2 Explanation
| Score (A:B) | Time (seconds) | Half | Overtake |
|---|---|---|---|
| $1:0$ | $15$ | $1$ | No |
| $1:1$ | $20$ | $1$ | No |
| $1:2$ | $25$ | $1$ | Yes (B) |
| $2:2$ | $30$ | $1$ | No |
| $3:2$ | $35$ | $1$ | Yes (A) |
| $3:3$ | $40$ | $1$ | No |
| $3:4$ | $45$ | $1$ | Yes (B) |
| $3:5$ | $50$ | $1$ | No |
| $4:5$ | $55$ | $1$ | No |
| $5:5$ | $60$ | $1$ | No |
| $6:5$ | $2065$ | $2$ | Yes (A) |
| $6:6$ | $2070$ | $2$ | No |
| $6:7$ | $2075$ | $2$ | Yes (B) |
Data Size and Constraints
For $100\%$ of the data, $1 \le A, B \le 2879$, and $1 \le A_s, B_s \le 2880$.
Scoring Method
Each group of data is worth $2$ points for the first line and $3$ points for the second line, totaling $5$ points per group.
Scoring requires the use of a Special Judge, details in the attachment.
Note
This problem's score is set according to the original COCI contest, with a maximum of $50$ points.
The problem is translated from COCI2018-2019 CONTEST #2 T1 Preokret.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分