Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题
2 seconds
256 megabytes
standard input
standard output
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 subtraction a - 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
- 5
6 7 8 9 10
5
1 2 3 4 5
- 15:10
- NOTE
- #include <cstdio>
- #include <cmath>
- #include <cstring>
- #include <ctime>
- #include <iostream>
- #include <algorithm>
- #include <set>
- #include <vector>
- #include <sstream>
- #include <queue>
- #include <typeinfo>
- #include <fstream>
- typedef long long ll;
- using namespace std;
- //freopen("D.in","r",stdin);
- //freopen("D.out","w",stdout);
- #define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
- struct point{
- int a;
- int b;
- };
- point num[];
- bool cmp(point a,point b)
- {
- if(a.a==b.a)
- return a.b>b.b;
- return a.a>b.a;
- }
- bool cmp1(point a,point b)
- {
- if(a.a==b.a)
- return a.b<b.b;
- return a.a>b.a;
- }
- int main()
- {
- int n1;
- cin>>n1;
- for(int i=;i<n1;i++)
- {
- cin>>num[i].a;
- num[i].b=;
- }
- int n2;
- cin>>n2;
- for(int i=;i<n2;i++)
- {
- cin>>num[n1+i].a;
- num[n1+i].b=;
- }
- sort(num,num+n1+n2,cmp);
- int ans=;
- int kill=;
- int flag=;
- int flag2=;
- for(int i=;i<n1+n2;i++)
- {
- if(num[i].b==)
- ans--;
- if(num[i].b==)
- ans++;
- if(ans>)
- ans=;
- if(ans==)
- flag=i;
- }
- int ans1=;
- int ans2=;
- for(int i=;i<n1+n2;i++)
- {
- if(i<=flag)
- {
- if(num[i].b==)
- ans1+=;
- if(num[i].b==)
- ans2+=;
- }
- if(i>flag)
- {
- if(num[i].b==)
- ans1+=;
- if(num[i].b==)
- ans2+=;
- }
- }
- if(num[flag].b==)
- {
- ans2-=;
- }
- cout<<ans1<<":"<<ans2<<endl;
- return ;
- }
Codeforces Round #281 (Div. 2) C. Vasya and Basketball 暴力水题的更多相关文章
- Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题
A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball 二分
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Codeforces Round #281 (Div. 2) C. Vasya and Basketball 排序
C. Vasya and Basketball Vasya follows a basketball game and marks the distances from which each te ...
- Codeforces Round #281 (Div. 2) B. Vasya and Wrestling 水题
B. Vasya and Wrestling 题目连接: http://codeforces.com/contest/493/problem/B Description Vasya has becom ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 水
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 镜面对称 博弈论
D. Vasya and Chess time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #281 (Div. 2) D. Vasya and Chess 博弈
D. Vasya and Chess Vasya decided to learn to play chess. Classic chess doesn't seem interesting to ...
- Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力
A. Vasya and Football Vasya has started watching football games. He has learned that for some foul ...
- Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)
简单题,却犯了两个错误导致WA了多次. 第一是程序容错性不好,没有考虑到输入数据中可能给实际已经罚下场的人再来牌,这种情况在system测试数据里是有的... 二是chronologically这个词 ...
随机推荐
- Asp.Net使用百度编辑器(ueditor)
1. 1.4.3以上版本将不再承诺支持ie6/ie7. 2.如果是aspx 需要加上 ValidateRequest="false" 3.Web.config <syst ...
- 读书笔记 effective c++ Item 28 不要返回指向对象内部数据(internals)的句柄(handles)
假设你正在操作一个Rectangle类.每个矩形可以通过左上角的点和右下角的点来表示.为了保证一个Rectangle对象尽可能小,你可能决定不把定义矩形范围的点存储在Rectangle类中,而是把它放 ...
- Python的日志记录-logging模块的使用
一.日志 1.1什么是日志 日志是跟踪软件运行时所发生的事件的一种方法,软件开发者在代码中调用日志函数,表明发生了特定的事件,事件由描述性消息描述,同时还包含事件的重要性,重要性也称为级别或严重性. ...
- http://s22.app1105796624.qqopenapp.com/
http://s22.app1105796624.qqopenapp.com/ http://121.43.114.69/xiyou/app/js/ac_tx.js http://hiyouba.co ...
- Flask:操作SQLite3(0.1)
Windows 10家庭中文版,Python 3.6.4,Flask 1.0.2 本文介绍了第一次在Flask框架中操作SQLite3数据库的测试,参考了官网的文档Using SQLite 3 wit ...
- 缓存数据库-redis(管道)
一:Redis 管道技术 Redis是一种基于客户端-服务端模型以及请求/响应协议的TCP服务.这意味着通常情况下一个请求会遵循以下步骤: 客户端向服务端发送一个查询请求,并监听Socket返回,通常 ...
- javascript本地缓存方案-- 存储对象和设置过期时间
cz-storage 解决问题 1. 前端js使用localStorage的时候只能存字符串,不能存储对象 cz-storage 可以存储 object undefined number string ...
- 洛谷P2458 保安站岗
传送门啦 分析: 树形dp刚刚入门,这是我做的第一个一个点同时受父亲节点和儿子节点控制的题目. 由于这个题中某一个点放不放保安与父亲和儿子都有关系(因为线段的两个端点嘛),所以我们做题时就要考虑全面. ...
- 面试经典问题---数据库索引B+、B-树
具体讲解之前,有一点,再次强调下:B-树,即为B树.因为B树的原英文名称为B-tree,而国内很多人喜欢把B-tree译作B-树,其实,这是个非常不好的直译,很容易让人产生误解.如人们可能会以为B-树 ...
- 通过field:global给子元素添加css样式
{dede:arclist row=5 typeid=200} <li [field:global runphp=’yes’ name=autoindex](@me==1)?@me=”class ...