## COCI '18 Contest 2 #1 Preokret

View as PDF

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

If they continue playing like this, soon the basketball players of the world's best league, the NBA, will put a ball in the basket every second. So there will no longer be any defense, tactics nor basketball. Let's imagine observing one of these future matches between Team A and Team B. We know how many points both Team A and Team B have scored and the exact second when it happened. Within a second, it will not be possible to score more than one point. King James is observing the task input and wants to answer the following two questions:

1. How many points have been scored during the first half-time, that is in the first half of the game, if we know that the entire game lasts minutes?

2. How many "turnarounds" have happened during the match, i.e. how many times has a team come from a losing situation (has strictly fewer points scored than the other team) to a leading one (has strictly more points scored than the other team)?

#### Input Specification

The first line contains a positive integer , the number of points Team A has scored. In the following lines there are positive integers , the seconds in which Team A was scoring points ordered from the smallest to the largest number.

In the line there is a positive integer , the number of points Team B has scored. In the following lines there are positive integers , the seconds in which Team B was scoring points ordered from the smallest to the largest number.

#### Output Specification

In the first line print an integer value, the answer to the first question from the text of the task.

In the second line print an integer value, the answer to the second question from the text of the task.

#### Scoring

The correct output of the first line is worth 2 points, and the correct output of the second one is worth 3 points. If you do not know how to solve some part of the task, print anything in the corresponding line.

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