He is offside!

Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 538 Accepted Submission(s):
333

Problem Description
Hemisphere Network is the largest television network in
Tumbolia, a small country located east of South America (or south of East
America). The most popular sport in Tumbolia, unsurprisingly, is soccer; many
games are broadcast every week in Tumbolia.

Hemisphere Network receives
many requests to replay dubious plays; usually, these happen when a player is
deemed to be offside by the referee. An attacking player is offside if he is
nearer to his opponents' goal line than the second last opponent. A player is
not offside if
●he is level with the second last opponent or
●he is level
with the last two opponents.

Through the use of computer graphics
technology, Hemisphere Network can take an image of the field and determine the
distances of the players to the defending team's goal line, but they still need
a program that, given these distances, decides whether a player is
offside.

 
Input
The input file contains several test cases. The first
line of each test case contains two integers A and D separated by a single space
indicating, respectively, the number of attacking and defending players involved
in the play (2 <= A,D <= 11). The next line contains A integers Bi
separated by single spaces, indicating the distances of the attacking players to
the goal line
(1 <= Bi <= 104). The next line contains D
integers Cj separated by single spaces, indicating the distances of the
defending players to the goal line (1 <= Cj <= 104). The end of
input is indicated by A = D = 0.
 
Output
For each test case in the input print a line containing
a single character: "Y"(uppercase) if there is an attacking player offside, and
"N"(uppercase) otherwise.
 
Sample Input
2 3
500 700
700 500 500
2 2
200 400
200 1000
3 4
530 510 490
480 470 50 310
0 0
 
Sample Output
N
Y
N
 
Source
 
 
 
 
 
 
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int t1[],t2[];
int main(){
int a,b;
while(scanf("%d%d",&a,&b)!=EOF){
if(a==&&b==)
break;
memset(t1,,sizeof(t1));
memset(t2,,sizeof(t2));
for(int i=;i<a;i++)
scanf("%d",&t1[i]);
for(int i=;i<b;i++)
scanf("%d",&t2[i]);
sort(t1,t1+a);
sort(t2,t2+b);
if(t1[]<t2[])
printf("Y\n");
else
printf("N\n"); } return ;
}

HDU 1939 HE IS OFFSIDE的更多相关文章

  1. hdu 3415 Max Sum of Max-K-sub-sequence 单调队列。

    Max Sum of Max-K-sub-sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

  2. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  3. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  4. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  6. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  7. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  8. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  9. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

随机推荐

  1. 第30章 ADC—电压采集—零死角玩转STM32-F429系列

    第30章     ADC—电压采集 全套200集视频教程和1000页PDF教程请到秉火论坛下载:www.firebbs.cn 野火视频教程优酷观看网址:http://i.youku.com/fireg ...

  2. 阿里数据库连接池druid

    官方wiki: https://github.com/alibaba/druid/wiki 实用方法介绍的想当详细,包含监控.扩展.大力推荐!

  3. System.Threading.Tasks

    前言: 我们之前介绍了两种构建多线程软件的编程技术(使用异步委托或通过System.Threading的成员).这两个可以在任何版本的.NET平台工作. 关于System.Threading 的介绍 ...

  4. Android 最新学习资料收集

    收集这份资料的灵感来源于我的浏览器收藏夹快爆了,后来在github 上也看到了很优秀的开源库的收集资料,非常的好,但是太过于多,也不够新,所以决定自己来做一个.原始的markdowm文件已经放到git ...

  5. java XML 通过BeanUtils的population为对象赋值 根据用户选择进行dom4j解析

    根据xml文件设计Student对象 <?xml version="1.0" encoding="UTF-8"?> <students> ...

  6. >题解< 校门外的树

    题目描述 某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是 11 米.我们可以把马路看成一个数轴,马路的一端在数轴 00 的位置,另一端在 LL 的位置:数轴上的每个整数点,即 0,1 ...

  7. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [spring/applicationContext-service.xml]: Cannot resolve refer

    <!-- aop --> <aop:config> <aop:pointcut expression="execution(* com.zsn.Service. ...

  8. C#基础-委托与事件

    委托 delegate是申明委托的关键字 返回类型都是相同的,并且参数类型个数都相同 委托声明 delegate double DelOperater(double num1, double num2 ...

  9. Altium Designer使用5:AD18的DXP在什么地方?

    1.在顶上的菜单栏右击

  10. linux无名管道

    特点 无名管道是半双工的,也就是说,一个管道要么只能读,要么只能写 只能在有共同祖先的进程间使用(父子进程.兄弟进程.子孙进程等) fork或者execve调用创建的子进程,继承了父进程的文件描述符 ...