首页 技术 正文
技术 2022年11月7日
0 收藏 427 点赞 971 浏览 2043 个字

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.

Input

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 ai (1 ≤ ai ≤ 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 bi (1 ≤ bi ≤ 2·109).

Output

Print two numbers in the format a:b — the score that is possible considering the problem conditions where the result of subtraction a - bis maximum. If there are several such scores, find the one in which number a is maximum.

Example

Input

3
1 2 3
2
5 6

Output

9:6

Input

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

Output

15:10两支队伍a,b,a进了n球 下面n个数为a队进球距离球筐的距离,
b进了m球,下面m个数为b队进球距离球筐的距离,
问三分线为多少时a队与b队的比分差值最大
输出比分 答案优先输出a大的。temp1=upper_bound(a,a+n,a[i])-a;
temp1=temp1*2+(n-temp1)*3;
upper_bound返回的是第一个大于a[i]的元素的指针,
数组从0开始,所以temp对应的就是小于a[i]的元素的个数
 #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
int a[],b[];
int main() {
int n,m,x,y;
while(scanf("%d",&n)!=EOF){
for (int i= ;i<n ;i++) scanf("%d",&a[i]);
scanf("%d",&m);
for (int i= ;i<m ;i++) scanf("%d",&b[i]);
if (n>=m) {
x=*n;
y=*m;
}else {
x=*n;
y=*m;
}
int temp1,temp2;
sort(a,a+n);
sort(b,b+m);
for (int i= ;i<n ;i++ ){
temp1=upper_bound(a,a+n,a[i])-a;
temp2=upper_bound(b,b+m,a[i])-b;
temp1=temp1*+(n-temp1)*;
temp2=temp2*+(m-temp2)*;
if (temp1-temp2==x-y){
if (temp1>x){
x=temp1;
y=temp2;
}
}else if (temp1-temp2>x-y){
x=temp1;
y=temp2;
}
}
for (int i= ;i<m ;i++ ){
temp1=upper_bound(a,a+n,b[i])-a;
temp2=upper_bound(b,b+m,b[i])-b;
temp1=temp1*+(n-temp1)*;
temp2=temp2*+(m-temp2)*;
if (temp1-temp2==x-y){
if (temp1>x){
x=temp1;
y=temp2;
}
}else if (temp1-temp2>x-y){
x=temp1;
y=temp2;
}
}
printf("%d:%d\n",x,y);
}
return ;
}

    					
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905