编程介的小学生 2017-09-27 13:28 采纳率: 20.5%
浏览 591
已采纳

Intuition of Escape

Description

One of the mysteries in the world of Faerieland is the lake of M. The lake's name comes from the legendary leader M (whose true name was, unfortunately, not recorded in the history of Faerieland) and it was said that once General M experienced a soul-stirring victory when he was still unknown to public. The official records during the battle at the lake of M about General M's command strategy make M more mysterious—approximately 2/3 of the tactics he made derives from his own intuition! Though some people hold the opinion that M's characteristic is no more than lucky since his enemies made as many mistakes as possible, others believe that M's victory relies on his outstanding estimation of the war situation.

Nowadays people are more interested in General M's unbelievable intuition since a new manuscript recording the whole battle is discovered. The last paragraph described that: "...The success of General M's plan destroyed the balance of the war and our victory can be expected soon. But enemy troops can not be destroyed immediately and they will absolutely assault at dawn. General M selected a route to retreat without any information of enemy troops and amazingly nobody has discovered our actions..." Since it really sounds fantastic, you want to verify whether M is as lucky as rumored.

You have accidentally got a sketch of the force distribution before M's retreat and you decided to confirm if M's successful retreat is possible. The biggest vehicle in M's troop can be described as a circle with radius R and initially its central point is at position (0,0). It can be assumed that if the biggest vehicle is not discovered, the whole troops will not be discovered. Each alert area of enemies can be described as a polygon. Note that two polygons may have a joint area. Since this vehicle has not been discovered by any of the enemies, we can believe that the circle would not intersect with any of the polygons during the movement. Besides, the biggest vehicle have some problems with its turning system so that it can only move at a certain direction (in another word, the route of this vehicle is a radial line with starting point (0,0)). If the vehicle never touches any of the alert area when it moves on the selected radial line, the escape is considered possible. Given the force distribution, you are needed to calculate whether M's escape is possible or there are conflicts between the two records.

Input

The first line contains a non-negative integer N, the number of polygons, at most 100.
The second line contains a positive floating number standing for the radius R of the biggest vehicle. It is guaranteed that the initial position of the vehicle will not intersect with any of the alert area.
The next N lines contain several integers each, representing a polygon. The first integer K(3 ≤ K ≤ 50) stands for the number of vertices of this polygon, and rest K pairs of floating numbers (x,y) stand for the positions of the vertices, in counterclockwise order. The coordinate will be in the range of -10000...10000.

Output

Output contains exactly one line. Write the word "Survive!" if M's escape is possible or the word "Baffling!" if M cannot select a route satisfy the rules mentioned above.  

Sample Input

Sample input 1
1
1
10 1.1 -5 8 -5 10 0 8 5 -8 5 -10 0 -8 -5 -1.1 -5 -3 2 3 2
Sample input 2
1
1
10 0.9 -5 8 -5 10 0 8 5 -8 5 -10 0 -8 -5 -0.9 -5 -3 2 3 2

Sample Output

Sample output 1
Survive!
Sample output 2
Baffling!

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-15 01:56
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘