HDU 1939 HE IS OFFSIDE
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
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.
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.
a single character: "Y"(uppercase) if there is an attacking player offside, and
"N"(uppercase) otherwise.
500 700
700 500 500
2 2
200 400
200 1000
3 4
530 510 490
480 470 50 310
0 0
Y
N
#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的更多相关文章
- 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 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
随机推荐
- 5、SpringBoot+Mybatis整合------多对多
开发工具:STS 代码下载链接:https://github.com/theIndoorTrain/SpringBoot_Mybatis/tree/3baea10a3a1104bda815c20695 ...
- SpringBoot学习10:springboot整合mybatis
需求:通过使用 SpringBoot+SpringMVC+MyBatis 整合实现一个对数据库中的 t_user 表的 CRUD 的操作 1.创建maven项目,添加项目所需依赖 <!--spr ...
- [优化]Steamroller-freecodecamp算法题目
晚上在medium看到一篇关于找工作的文章,里面提到一个面试题目--flattening an array(扁平化数组).这我好像在哪看过!应该是freecodecamp里的算法某一题.翻了下博客记录 ...
- HJ浇花
题目描述 HJ养了很多花(99999999999999999999999999999999999盆),并且喜欢把它们排成一排,编号0~999999999999999999999999999999999 ...
- 前端之jquery函数库
jquery介绍 jQuery是目前使用最广泛的javascript函数库.据统计,全世界排名前100万的网站,有46%使用jQuery,远远超过其他库.微软公司甚至把jQuery作为他们的官方库. ...
- 使用c++控制sqlite3
首先,到官网下载相关的压缩包 https://www.sqlite.org/download.html 但是要自己再重新编译一个, 博主自己收集了一下,密码:hixo https://pan.baid ...
- java基础不牢固容易踩的坑
java基础不牢固容易踩的坑 经过一年java后端代码以及对jdk源码阅读之后的总结,对java中一些基础中的容易忽略的东西写下来,给偏爱技术热爱开源的Coder们分享一下,避免在写代码中误入雷区. ...
- python__高级 : 类当作装饰器
类在创建对象时,会调用 __init__ 初始化一些东西 , 然后 如果类中定义了 __call__ 方法,可以直接用 对象() 这种方法调用,所以可以用类来装饰函数: class Test(ob ...
- Java中的二进制运算出错问题
问题: 最近在做Java web项目中需要计算金额总和,在这里出现了一个问题是我以前没有关注到的: System.out.println(2.0-1.1); 执行时候的console中打印输出的是 0 ...
- stark组件(4):列表定义列,展示数据库数据
效果图: 一.Stark组件 stark/service/core_func.py from django.urls import re_path from django.shortcuts impo ...