当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3534:Escape of Life and Death

题目描述

During his ambitious adventure in search of treasure, Yangyang discovered an ancient underground palace. After thoroughly exploring the palace, he found that it was constructed with elaborately decorated chambers connected by fortified corridors. Out of an explorer’s instinct, he sketched a complete map of the palace before entering the largest and most magnificent chamber, which lied in the heart of the palace.

Standing at the center of the chamber, Yangyang looked around and was profoundly amazed by those vivid, huge statues of the gods. He recognized the tallest one, which depicted God Proxima holding his sacred cane. All of a sudden, a voice took Yangyang by surprise, “Leave now, you stupid human!” It was loud but sounded as if it came from the distance. A thought of danger immediately flashed through Yangyang’s mind: his intrusion into the palace had triggered a spell of destruction. Now an earthquake was emerging from right under the chamber and growing more and more violent. He must escape from underground for life as quickly as possible.

Yangyang knew that seismic waves propagated isotropically at a constant speed. If they spread across any chamber, the chamber would collapse, trap anybody inside and become impassable. However, the corridors were adequately solid to stand any impact of earthquake. Driven by his fearless but obstinate character, Yangyang would only allow himself to run from one chamber to another one which was farther away from the epicenter except when he was going to run toward chamber n + 1.

Yangyang had measured the location of each chamber and estimated the time he needed to run through each corridor. How soon could he accomplish the escape of life and death?

输入解释

The input consists of a single test case. The first line of input contains three integers n, m, v (1 ≤ n ≤ 50,000, 1 ≤ m ≤ 200,000, 1 ≤ v ≤ 1,000). Next come n lines, each containing a pair of integers (xi, yi) (−109xi, yi ≤ 109, ∀1 ≤ in). The following m lines each contains three integers ai, bi, ti (0 ≤ ai, bin + 1, 1 ≤ ti ≤ 1,000, ∀1 ≤ im). The last line contains two pairs of integers (x0, y0), (xn+1, yn+1) (−109x0, y0, xn+1, yn+1 ≤ 109).

There were n + 2 chambers in total, numbered 0 through n + 1. Chamber 0 was where Yangyang found the statue of God Proxima; chamber n + 1 was located, as the only exception, on the ground and would not trap Yangyang even if it collapsed. Chamber i (1 ≤ in) was located at (xi, yi). Corridor i (1 ≤ im) connected chambers ai and bi, and Yangyang needed ti units of time to run through it. Seismic waves propagated at constant speed v.

输出解释

If Yangyang could escape, output the minimum time he needed; otherwise, output “Impossible”.

输入样例
1 2 1
3 4
0 1 5
1 2 5
0 0 6 8
输出样例
Impossible
提示

As can be inferred from the sample test case, if seismic waves reached a chamber at the very moment Yangyang began to escape from it, he would still get trapped.

来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3534

最后修改于 2020-10-29T07:03:55+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 131072