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.
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).
Print two numbers in the format a:b — the score that is possible considering the problem conditions where the result of subtractiona - b is maximum. If there are several such scores, find the one in which number a is maximum.
3
1 2 3
2
5 6
9:6
///meek #include<bits/stdc++.h> using namespace std; typedef long long ll; #define mem(a) memset(a,0,sizeof(a)) #define pb push_back inline ll read() { ll x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); } while(ch>='0'&&ch<='9'){ x=x*10+ch-'0';ch=getchar(); }return x*f; } //**************************************** const int N=2000005; #define mod 10000007 #define inf 2000000007 #define maxn 10000 ll lna,lnm,n,a[N],b[N],m; struct ss{ ll x,in,index; }s[N+N]; struct sss { ll x,aa; int in; }W[N+N]; int cmp(ss s1,ss s2) { if(s1.x==s2.x) return s1.in<s2.in; return s1.x<s2.x; } int cmp2(sss s1,sss s2) { if(s1.x==s2.x) return s1.aa<s2.aa; else return s1.x<s2.x; } int main() { n=read(); int k=0; for(int i=1;i<=n;i++) { scanf("%I64d",&a[i]); s[++k].x=a[i]; s[k].in=0; s[k].index=i; } m=read(); for(int i=1;i<=m;i++) { scanf("%I64d",&b[i]); s[++k].x=b[i]; s[k].in=1; s[k].index=i; } sort(s+1,s+k+1,cmp); ll l=0,r=0; for(int i=1;i<=k;i++) { if(s[i].in==0) { l++; } else r++; W[i].x=(l*2+(n-l)*3)-(r*2+(m-r)*3); W[i].aa=(l*2+(n-l)*3); W[i].in=i; } W[++k].x=n*3-m*3; W[k].aa=(n*3); W[k].in=-1; W[++k].x=n*2-m*2; W[k].aa=(n*2); W[k].in=-2; sort(W+1,W+k+1,cmp2); ll ansl=0,ansr=0; ansl=W[k].aa;ansr=W[k].aa-W[k].x; cout<<ansl<<":"<<ansr<<endl; return 0; }