![]() |
||||||||||
|
||||||||||
The Voyages of Zheng HeTime 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–1433) 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
Sample Output
Source | ||||||||||
|