F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Voyages of Zheng He

Time Limit: 30000/20000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 79    Accepted Submission(s): 2


Problem Description


Zheng He (1371¨C1433) was a Hui-Chinese mariner, explorer, diplomat and fle et admiral, who commanded seven voyages to Southeast Asia, South Asia, the Middle East, and East Africa, collectively referred to as the Voyages of Zheng He.
His fle et was by far the largest and most advanced fleet in the world at his time, and his voyages were about 80 years earlier than Columbus' America discovering voyage.
Recently some Chinese ACMers just found an old document about Zheng He's Voyage. It said:
Once upon a time, when Zheng He was sailing along the Malaysia coast, a strange volcano suddenly erupted.The volcano threw some strange hot rocks on the sea. Those rocks floated on the water at first, and after some time, when water went into their center, they would explode. Every rock could be considered as a point and it had a set of properties X, Y, R, T and L, meaning that:
The position of the rock was (X, Y). The rock would explode at time T, and the explosion would last until time T+L. During the time interval [T, T+L](both ends are included), any ship whose distance from that rock was no more than R would be destroyed.
At time 0, Zheng He's ship was at the position (0, 0), and his ship could also be considered as a point. When talking about "distance", it means the Manhattan Distance. In a plane, the Manhattan Distance between (x1, y1) and (x2, y2) is |x1 - x2| + |y1 - y2|. Zheng He's ship could only move horizontally or vertically. The maximum speed of Zheng He's ship was 1 per second. That means, if Zheng He's ship was at (x, y) now, then 1 second latter it may arrive at any point in the region S( S={(x1,y1) | |x1-x|+|y1-y| <= 1}).
Suppose Zheng He knew every rock's properties. Given time P, Zheng He wanted to know whether he could survive after time P.
 

Input
Input contains several test cases. For each test case:
The first line contains 2 integers, N and P (1<=N<=1000,1<=P<=1000000), indicating that there were N rocks on the sea and Zheng He wanted to know whether he could survive after time P.
Then N lines follow. Each line describes a rock by 5 integers ---- X, Y, R, T and L(-50<=X, Y<=50, 1<=R<=50, 1<=T, L<=10000) mentioned above.
Input ends with N = P = 0.
 

Output
For each test case, If Zheng He can survive after time P, please print "Zheng can survive." But if P <= 100, you should print one extra line "The survive area is : A", where A is the area of the region which Zheng He can safely reach at time P (rounded to 3 digits after the decimal point). If Zheng He cannot survive, please print "Zheng dies at : H", where H is the latest time Zheng He can survive (H is an integer and Zheng He will be alive at time H but be dead at time H+1). Note that there are one space before the mark ":" and one after it.
 

Sample Input
4 30 50 50 50 50 100 -50 50 50 50 100 50 -50 50 50 100 -50 -50 50 50 100 3 20 -1 -4 4 3 7 -4 2 8 6 1 4 -3 10 10 10 0 0
 

Sample Output
Zheng can survive. The survive area is : 1800.000 Zheng dies at : 10
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 10:26:47, Gzip enabled