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. FTP服务安装及使用

    准备工作:一台服务器.我这里使用的是阿里云的ECS. 环境使用的是:windows 2008 r2 用途:FTP是用来进行文件传输的,我们可以把这个目录在IIS上配置成发布的网站,我们在本地只用把我们 ...

  2. C# foreach语句

    一.C# foreach语句 foreach语句能够对实现Ienumerable接口的容器进行遍历,并提供一个枚举器来实现Ienumerable接口.foreach语句为数组或对象集合中的各个元素执行 ...

  3. checkboxlist如何配置数据源?

    在做项目中,通常checkboxlist中的checkitems不是固定的,需要绑定可变的数据源,把数据添加到list集合中,代码如下 DataSet myData = new DataSet(); ...

  4. JQuery 解决按钮上的倒计时问题

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  5. 表单验证实现React-router跳转

    方法一:broserHistory.push handleSubmit(e){ e.preventDefault(); const path = '/demo'; broserHistory.push ...

  6. 网页更换主题以及绘制图形js代码实现

    HTML代码实现: <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...

  7. 使用c++控制sqlite3

    首先,到官网下载相关的压缩包 https://www.sqlite.org/download.html 但是要自己再重新编译一个, 博主自己收集了一下,密码:hixo https://pan.baid ...

  8. 转:Java后端面试自我学习

    引自:https://www.cnblogs.com/JavaArchitect/p/10011253.html 最近面试java后端开发的感受:如果就以平时项目经验来面试,通过估计很难——再论面试前 ...

  9. H5之audio标签放音兼容所有浏览器方法

    前端交流群,群文件提供大量文档.书籍和资料.期待你的加入!群号:127768464 由于项目需要,最近刚做了一个网页放音的功能,使用到了H5新标签<audio></audio> ...

  10. C语言结构体指针成员强制类型转换

    #include <stdio.h> #include <stdlib.h> typedef struct ListElmt_ { void *data; struct Lis ...