493C.md (1598B)
1 Source: https://codeforces.com/problemset/problem/493/C 2 3 C. Vasya and Basketball 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from doesn't exceed some value of *d* meters, and a throw is worth 3 points if the distance is larger than *d* meters, where *d* is some non-negative integer. 22 23 Vasya would like the advantage of the points scored by the first team (the points of the first team minus the points of the second team) to be maximum. For that he can mentally choose the value of *d*. Help him to do that. 24 25 Input 26 27 The first line contains integer *n* (1 ≤ *n* ≤ 2·105) — the number of throws of the first team. Then follow *n* integer numbers — the distances of throws *a**i* (1 ≤ *a**i* ≤ 2·109). 28 29 Then follows number *m* (1 ≤ *m* ≤ 2·105) — the number of the throws of the second team. Then follow *m* integer numbers — the distances of throws of *b**i* (1 ≤ *b**i* ≤ 2·109). 30 31 Output 32 33 Print two numbers in the format a:b — the score that is possible considering the problem conditions where the result of subtraction *a* - *b* is maximum. If there are several such scores, find the one in which number *a* is maximum. 34 35 Examples 36 37 Input 38 39 ``` 40 3 41 1 2 3 42 2 43 5 6 44 ``` 45 46 Output 47 48 ``` 49 9:6 50 ``` 51 52 Input 53 54 ``` 55 5 56 6 7 8 9 10 57 5 58 1 2 3 4 5 59 ``` 60 61 Output 62 63 ``` 64 15:10 65 ```