포럼
문제 ICPC00216

G. Galaxy Quest

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

You are travelling through the galaxy in your spaceship. There are \(n\) planets in the galaxy, numbered from \(1\) to \(n\) and modelled as points in \(3\)-dimensional space.

You can travel between these planets along \(m\) space highways, where each highway connects two planets along the straight line between them. Your engine can accelerate (or decelerate) at \(\SI{1}{\metre\per\second\squared}\), while using fuel at a rate of \(1\) litre per second. There is no limit to how fast you can go, but you must always come to a complete standstill whenever you arrive at the planet at the end of a highway.

It is possible for a highway to pass through planets other than the ones it connects. However, as your spaceship is equipped with special hyperspace technology, it simply phases through these obstacles without any need of stopping. Another consequence of using this technology is that it is impossible to jump from one highway to another midway through: highways must always be travelled in full.

You need to fly several missions, in which you start at your home planet (with number \(1\)) and need to reach a given target planet within a given time limit. For each mission, determine whether it can be completed, and if so, find the least amount of fuel required to do so. As an example, Figure shows the optimal route for the second mission of the first sample.

제약
입력 형식

The input consists of:
- One line with three integers \(n\), \(m\), and \(q\) (\(1 \le n,m,q \le 10^5\), \(n \ge 2\)), where \(n\) is the number of planets, \(m\) is the number of space highways, and \(q\) is the number of missions.
- \(n\) lines, each with three integers \(x_i\), \(y_i\), and \(z_i\) (\(\left|x_i\right|,\left|y_i\right|,\left|z_i\right| \le 10^3\), \(1 \le i \le n\)), the coordinates of planet \(i\).
- \(m\) lines, each with two integers \(a\) and \(b\) (\(1 \le a,b \le n\), \(a \neq b\)), describing a space highway that connects planets \(a\) and \(b\). It can be traversed in either direction.
- \(q\) lines, each with two integers \(c\) and \(t\) (\(2 \le c \le n\), \(1 \le t \le 10^3\)), the target planet and time limit for each mission.

The \(n\) planets are in distinct locations. Their coordinates are given in metres, and the time limits of the missions are given in seconds. No two highways connect the same pair of planets. For each mission, both the absolute and relative differences between the given time limit and the shortest possible completion time are at least \(10^{-6}\).

출력 형식

For each mission, output the least amount of fuel in litres required to reach the target location within the time limit. If the target location cannot be reached within the time limit, output "impossible".

Your answers should have an absolute or relative error of at most \(10^{-6}\).

예제 1
입력
4 4 3
-30 0 0
0 0 0
50 0 0
-30 10 0
1 2
2 3
3 4
4 1
2 10
3 25
4 7
출력
impossible
19.0538441903
4.0000000000
예제 2
입력
4 2 5
-3 0 2
7 -9 -3
4 4 -6
8 -1 8
1 2
2 3
2 1000
2 100
3 1000
3 100
4 1000
출력
0.0287058122
0.2874671888
0.1120998619
1.1272896971
impossible
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2023

평가 및 의견

G. Galaxy Quest

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

G. Galaxy Quest

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8