coderforce 527A Arrays
来源:互联网 发布:迪卡侬 天猫 知乎 编辑:程序博客网 时间:2024/06/06 15:03
题意:给你两个数组。问,在数组A中随便选K个,在数组中随便选M个,问你,是否有可能所选的数中,B中的数都比A中的大。
简单贪心
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define LL long longconst LL maxm=1e5+10;LL a[maxm];LL b[maxm];int main(){ LL na,nb; while(scanf("%lld%lld",&na,&nb)!=EOF) { LL k,m; scanf("%lld%lld",&k,&m); for(LL i=0;i<na;i++) { scanf("%lld",&a[i]); } for(LL i=0;i<nb;i++) { scanf("%lld",&b[i]); } sort(a,a+na); sort(b,b+nb); if(a[k-1]<b[nb-m]) { printf("YES\n"); } else { printf("NO\n"); } } return 0;}
1 0
- coderforce 527A Arrays
- coderforce 2A-Winner
- coderforce 282A Bit++
- coderforce 306A Candies
- coderforce 534A Exam
- coderforce 483A Counterexample
- 【CoderForce A】Contest
- coderforce 579A Raising Bacteria
- coderforce A.Ilya and Diplomas
- coderforce 540A Combination Lock
- coderforce 550A. Two Substrings
- coderforce 549A Face Detection
- coderforce 490A - Team Olympiad
- Coderforce 602A Two Bases
- coderforce 482A. Diverse Permutation
- Coderforce 598A Tricky Sum
- coderforce 296A Yaroslav and Permutations
- coderforce 304a - Pythagorean Theorem II
- MOOC上的数据科学学习路线图
- 火云开发课堂 - 《Shader从入门到精通》系列 第二十二节:在Shader中实现3D方向光
- C++中栈和队列
- Linux 内核Tcp Socket参数调优
- IOS开发—App 在 IOS 8 的simulator运行时,定位卡死bug解决
- coderforce 527A Arrays
- reverse mapping checking getaddrinfo for bogon failed – POSSIBLE BREAK-IN ATTEMPT! 错误
- PHP file_get_contents() 函数读取文件内容
- git命令小记
- How to install MySQL JDBC driver in Eclipse web project without java.lang.ClassNotFoundexception com
- centos6.5下安装zabbix
- svn点滴记录
- Struts2 + Spring + hibernate 框架搭成实例
- SQLserver数据库中关于递归的查询使用