CF-845A
A. Chess Tourneytime limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Berland annual chess tournament is coming!
Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organizers should guarantee the win for the team of BerOil.
Thus, organizers should divide all 2·n players into two teams with n people each in such a way that the first team always wins.
Every chess player has its rating ri. It is known that chess player with the greater rating always wins the player with the lower rating. If their ratings are equal then any of the players can win.
After teams assignment there will come a drawing to form n pairs of opponents: in each pair there is a player from the first team and a player from the second team. Every chess player should be in exactly one pair. Every pair plays once. The drawing is totally random.
Is it possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardlessof the results of the drawing?
InputThe first line contains one integer n (1 ≤ n ≤ 100).
The second line contains 2·n integers a1, a2, ... a2n (1 ≤ ai ≤ 1000).
OutputIf it's possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing, then print "YES". Otherwise print "NO".
Examplesinput2
1 3 2 4outputYESinput1
3 3outputNO
对2*n个数排序,比较n和n-1打大小,若n>n-1则YES。
AC代码:
#include<bits/stdc++.h>
using namespace std; int a[]; int main(){
ios::sync_with_stdio(false);
int n;
cin>>n;
for(int i=;i<n*;i++){
cin>>a[i];
}
sort(a,a+*n);
if(a[n]==a[n-]){
cout<<"NO"<<endl;
}
else{
cout<<"YES"<<endl;
}
return ;
}
CF-845A的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
- CF #374 (Div. 2) D. 贪心,优先队列或set
1.CF #374 (Div. 2) D. Maxim and Array 2.总结:按绝对值最小贪心下去即可 3.题意:对n个数进行+x或-x的k次操作,要使操作之后的n个数乘积最小. (1)优 ...
随机推荐
- VS中Component Class、User Control及Custom Control的区别 .
.NET Framework 为您提供了开发和实现新控件的能力.除了常见的用户控件外,现在您会发现,您可以编写能执行自身绘图的自定义控件,甚至还可以通过继承扩展现有控件的功能.确定创建何种类型的控件可 ...
- 1355: [Baltic2009]Radio Transmission[循环节]
1355: [Baltic2009]Radio Transmission Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 796 Solved: 538 ...
- 九度OJ 1053:互换最大最小数 (基础题)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6613 解决:2676 题目描述: 输入一个数n,然后输入n个数值各不相同,调换数组中最大和最小的两个数,然后输出. 输入: 测试数据有多组 ...
- 【docker】开启remote api访问,并使用TLS加密
背景: docker默认是能使用本地的socket进行管理,这个在集群中使用的时候很不方便,因为很多功能还是需要链接docker服务进行操作,docker默认也可以开启tcp访问,但是这就相当于把整个 ...
- Java for LeetCode 119 Pascal's Triangle II
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3 ...
- BZOJ 3362 Navigation Nightmare
一道带权并查集题目. 带权并查集的重点是信息的合并. 这类题出现得并不多,练习一下. #include<bits/stdc++.h> using namespace std; #defin ...
- <再看TCP/IP第一卷>关于网络层及协议细节---IP协议
说到关于IP协议,就必须先说IP协议的两个特性: (一)不可靠性(unreliable) 不可靠性的意思是它不能保证IP数据报能成功地到达目的地,IP所能做的只是提供最好的传输服务,IP有一个简单的错 ...
- 吴恩达机器学习笔记(九) —— 异常检测(Anomaly detection)
主要内容: 一.模型介绍 二.算法过程 三.算法性能评估及ε(threshold)的选择 四.Anomaly detection vs Supervised learning 五.Multivaria ...
- myeclipse内存不足的处理
Myeclipse内存溢出解决方案 1.tomcat内存扩展 修改tomcat中bin目录下catalina.bat文件在echo Using CATALINA_BASE: "%CATAL ...
- Oracle 数据库SQL
原作者:http://blog.csdn.net/jihuanliang/article/details/7205968 总体说说可能出现的原因: 情况场景: 表A中有个字段是外键,关联了表B中的某字 ...