CF493C.Vasya and Basketball
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
瓦西娅正在观看一场篮球比赛,并记录了每支队伍每次投篮的距离。他知道,每次成功的投篮得分为 2 分或 3 分:若投篮距离不超过某个值 $ d $ 米,则得 2 分;若投篮距离大于 $ d $ 米,则得 3 分,其中 $ d $ 是某个非负整数。
瓦西娅希望第一支队伍的得分优势(即第一支队伍得分减去第二支队伍得分)尽可能大。为此,他可以在脑海中选择合适的 $ d $ 值。请帮助他实现这一目标。
输入格式
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).
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).
第一行包含一个整数 n(1≤n≤2⋅105)—— 第一队的投掷次数。接下来是 n 个整数 —— 各次投掷的距离 ai(1≤ai≤2⋅109)。
随后是一个整数 m(1≤m≤2⋅105)—— 第二队的投掷次数。接下来是 m 个整数 —— 各次投掷的距离 bi(1≤bi≤2⋅109)。
输出格式
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.
按 a:b 的格式输出两个数——在题目条件下可能的得分,且使得减法结果 a−b 最大。如果存在多个这样的得分,则选择其中 a 最大的那个。
输入输出样例
输入#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
输入解题思路,AI测评打分。不知道怎么写?