Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- #include<cstdlib>
- #include<climits>
- #include<cmath>
- #include<string>
- #include<sstream>
- #include<vector>
- #include<list>
- #include<deque>
- #include<stack>
- #include<queue>
- #include<set>
- #include<map>
- #include<algorithm>
- #include<iterator>
- #include<numeric>
- #include<fstream>
- #define FORF(i,a,b) for(int i=a; i<=b; ++i)
- #define FORB(i,a,b) for(int i=a; i>=b; --i)
- #define ALL(v) v.begin(),v.end()
- #define min3(a,b,c) min(min(a,b),c)
- #define SIZE 100010
- #define MAXN 3000000
- using namespace std;
- typedef long long LL;
- struct basket
- {
- int team;
- LL dist;
- friend bool operator<(basket b1,basket b2)
- {
- return b1.dist<b2.dist;
- }
- };
- int N,M;
- int cnt1,cnt2;
- LL scA,scB,cuA,cuB;
- int main()
- {
- basket bsk[SIZE];
- scanf("%d",&N);
- FORF(i,0,N-1)
- {
- scanf("%d",&bsk[i].dist);
- bsk[i].team=1;
- }
- scanf("%d",&M);
- FORF(i,0,M-1)
- {
- scanf("%d",&bsk[i+N].dist);
- bsk[i+N].team=2;
- }
- sort(bsk,bsk+N+M);
- scA=3*N;
- scB=3*M;
- for(int i=0; i<N+M;)
- {
- do
- {
- if(bsk[i].team==1)
- ++cnt1;
- else
- ++cnt2;
- ++i;
- }while(i<N+M && bsk[i-1].dist==bsk[i].dist);
- cuA=2*cnt1 + 3*(N-cnt1);
- cuB=2*cnt2 + 3*(M-cnt2);
- if(cuA-cuB>scA-scB || (cuA-cuB==scA-scB && cuA>scA))
- {
- scA=cuA;
- scB=cuB;
- }
- }
- printf("%I64d:%I64d\n",scA,scB);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement