编程介的小学生 2017-09-16 08:35 采纳率: 20.5%
浏览 797
已采纳

He is offside!

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

  • 写回答

1条回答 默认 最新

  • devmiao 2017-09-30 01:27
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题