日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分

發布時間:2025/3/20 编程问答 15 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

C. Vasya and Basketball

題目連接:

http://codeforces.com/contest/493/problem/C

Description

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?-?b is maximum. If there are several such scores, find the one in which number a is maximum.

Sample Input

3
1 2 3
2
5 6

Sample Output

9:6

Hint

題意

A隊在n個距離位置投進了籃球,B隊在m個位置。

現在讓你來劃3分線,然后使得A隊分數減去B隊分數最大。

題解:

暴力枚舉三分線,肯定三分線就n+m+4種可能,都暴力枚舉一邊,然后對于每一個隊伍,我二分找到有多少個二分球,和多少個三分球就好了

代碼

#include<bits/stdc++.h> using namespace std; const int maxn = 2e5+7; int n,m; int a[maxn],b[maxn]; int Ans=-1e9,Ans2,Ans3; void update(int x,int y,int z) {if(Ans<x)Ans=x,Ans2=y,Ans3=z;if(Ans==x&&y>Ans2)Ans=x,Ans2=y,Ans3=z; } void get(int x) {int l=0,r=m,ans=1;while(l<=r){int mid=(l+r)/2;if(b[mid]<=x)ans=mid,l=mid+1;else r=mid-1;}int l2=0,r2=n,ans2=1;while(l2<=r2){int mid=(l2+r2)/2;if(a[mid]<=x)ans2=mid,l2=mid+1;else r2=mid-1;}update(ans2*2+(n-ans2)*3-ans*2-(m-ans)*3,ans2*2+(n-ans2)*3,ans*2+(m-ans)*3); } int main() {scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&a[i]);scanf("%d",&m);for(int i=1;i<=m;i++)scanf("%d",&b[i]);sort(a+1,a+1+n);sort(b+1,b+1+m);update(2*n-2*m,2*n,2*m);update(3*n-3*m,3*n,3*m);for(int i=1;i<=n;i++)get(a[i]);get(a[1]-1);get(a[n]+1);for(int i=1;i<=m;i++)get(b[i]);get(b[1]-1);get(b[m]+1);printf("%d:%d\n",Ans2,Ans3); }

轉載于:https://www.cnblogs.com/qscqesze/p/5844267.html

總結

以上是生活随笔為你收集整理的Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲成人黄色在线 | 农村妇女毛片精品久久久 | 日韩在线观看视频免费 | 精品人妻av一区二区 | 国产又黄又猛又爽 | 日韩在线一二三 | 亚洲www啪成人一区二区麻豆 | 午夜一二三区 | 色噜噜狠狠一区二区三区果冻 | 欧美 日韩 国产 在线 | 高清欧美性猛交xxxx | 国产丝袜精品视频 | 国产精品人人爽人人爽 | 97色婷婷 | 91禁国产网站 | 色黄大色黄女片免费中国 | 少妇一级淫片免费放播放 | 欧美韩日国产 | 美女精品一区二区 | 综合色导航 | 51热门大瓜今日大瓜 | 波多野结衣视频播放 | 中国一级大黄大黄大色毛片 | 久久人人妻人人人人妻性色av | 五月天婷婷色 | 国产永久免费 | 欧美久操 | 亚洲福利网址 | 男女插插网站 | 亚洲AV午夜成人片 | 日韩不卡 | av手机免费观看 | 天天干干天天 | 蜜桃aaa | 亚洲国产私拍精品国模在线观看 | 综合国产精品 | 黑人巨大猛烈捣出白浆 | 一区二区三区久久久久 | 九色porny视频 | 午夜色网 | 美脚の诱脚舐め脚视频播放 | 欧美 国产 精品 | 欧美在线视频免费 | 免费看av的网址 | 伊人首页 | 在线视频一二区 | 极品少妇xxxx | 国产精品久久久999 www日本高清视频 | 超碰香蕉 | 亚洲字幕成人中文在线观看 | 亚洲欧美精品一区二区三区 | 男女无套免费视频网站动漫 | 人妻体内射精一区二区 | 久久久久国产一区二区三区 | 簧片av| 极品人妻一区二区 | www狠狠操 | 黄色一级国产 | 特级黄色大片 | 91超级碰 | 黄色一级国产 | 日韩精品极品视频 | 亚洲免费成人在线 | www超碰 | 久久久国产精品无码 | 成人资源在线观看 | 91一区二区视频 | 免费看黄网站在线 | 国产欧美久久一区二区三区 | 91在线视频精品 | 可以免费在线观看的av | 国产精品久久久久久久久久久不卡 | 中文字幕少妇在线三级hd | 色爱综合 | 中文字幕视频网站 | 国产熟女一区二区丰满 | 亚洲偷| 免费观看成人在线视频 | 国产乱码精品一区二三区蜜臂 | 捆绑束缚调教 | 国产男女无套免费网站 | v片在线免费观看 | 一级片免费网址 | 国产精品亚洲一区 | 日韩一区二区三区三四区视频在线观看 | 鲁一鲁一鲁一鲁一av | 日韩av免费看 | 色欲av无码一区二区三区 | 亚洲av毛片一区二二区三三区 | av免费观看网 | 椎名由奈在线观看 | 日日夜夜免费精品 | 国产免费无遮挡 | 亚洲欧美成人一区二区 | 无码一区二区三区免费视频 | 超碰在线观看免费版 | 国产成人自拍视频在线 | 亚洲视频黄 | 午夜免费成人 |