302552: CF493C. Vasya and Basketball

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Vasya and Basketball

题意翻译

### 题意简述 Vasya 记录了一场篮球赛中两支队伍每次**命中的**投篮离篮筐的距离。他知道每一次成功的投篮可以得到 $2$ 分或 $3$ 分。如果一次**命中的**投篮离篮筐不超过 $d(d \ge 0)$ 米则得 $2$ 分,否则得 $3$ 分。Vasya 可以指定一个 $d$,同时他希望第一支队伍的分数 $a$ 减去第二支队伍的分数 $b$ 最大。 请你帮他求出这个 $d$。 ### 输入格式 第一行一个正整数 $n(1\leq n \leq 2 \cdot 10^5)$,表示第一支队伍的命中数。 接下来一行 $n$ 个正整数 $a_1,a_2,\cdots,a_n(1\leq a_i \leq 2 \cdot 10^9)$,表示每一次命中离篮筐的距离。 第一行一个正整数 $m(1\leq m \leq 2 \cdot 10^5)$,表示第二支队伍的命中数。 接下来一行 $m$ 个正整数 $b_1,b_2,\cdots,b_n(1\leq b_i \leq 2\cdot 10^9)$,表示每一次命中离篮筐的距离。 ### 输出格式 输出一行两个整数 $a$,$b$,**分别表示两队的分数,中间用符号 `:` 分隔**。您应该最大化 $a-b$,如果有相同的 $a - b$,应该最大化 $a$。 翻译贡献者 U108949

题目描述

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. 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.

输入输出格式

输入格式


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. 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.

输出格式


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.

输入输出样例

输入样例 #1

3
1 2 3
2
5 6

输出样例 #1

9:6

输入样例 #2

5
6 7 8 9 10
5
1 2 3 4 5

输出样例 #2

15:10

Input

题意翻译

### 题意简述 Vasya 记录了一场篮球赛中两支队伍每次**命中的**投篮离篮筐的距离。他知道每一次成功的投篮可以得到 $2$ 分或 $3$ 分。如果一次**命中的**投篮离篮筐不超过 $d(d \ge 0)$ 米则得 $2$ 分,否则得 $3$ 分。Vasya 可以指定一个 $d$,同时他希望第一支队伍的分数 $a$ 减去第二支队伍的分数 $b$ 最大。 请你帮他求出这个 $d$。 ### 输入格式 第一行一个正整数 $n(1\leq n \leq 2 \cdot 10^5)$,表示第一支队伍的命中数。 接下来一行 $n$ 个正整数 $a_1,a_2,\cdots,a_n(1\leq a_i \leq 2 \cdot 10^9)$,表示每一次命中离篮筐的距离。 第一行一个正整数 $m(1\leq m \leq 2 \cdot 10^5)$,表示第二支队伍的命中数。 接下来一行 $m$ 个正整数 $b_1,b_2,\cdots,b_n(1\leq b_i \leq 2\cdot 10^9)$,表示每一次命中离篮筐的距离。 ### 输出格式 输出一行两个整数 $a$,$b$,**分别表示两队的分数,中间用符号 `:` 分隔**。您应该最大化 $a-b$,如果有相同的 $a - b$,应该最大化 $a$。 翻译贡献者 U108949

加入题单

上一题 下一题 算法标签: