RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00020

J. Shortest Flight Path

Unrated 레이팅 미적용
난이도
3s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Commercial flights are statistically quite safe (in terms of number of deaths per passeng\(er-ki\)lometer, only going to the moon is safer). But there are still reasons for precautions and safety regulations. An early such rule was the \(so-ca\)lled “\(60-mi\)nute rule,” which required that a t\(wo-en\)gine plane must always be within 60 minutes of the nearest adequate airport along its entire flight path. A variety of similar rules have existed, but at their core, they remain the same: the flight path can not take the airplane more than a certain maximum allowed distance from the nearest airport. With these restrictions, planes cannot always use a direct route for flying from one airport to another. In this problem we will compute the shortest flight path between two airports while adhering to a m\(ax- im\)um allowed distance rule. In the figure below, which illustrates the first sample test case, any flight route has to stay within the three circles. Thus a plane going from airport 2 to airport 3 has to detour from the direct route via the region around airport 1. Note that the plane would not necessarily have to go to airport 1 itself. Things are further complicated by the fact that planes have limited fuel supply, and to go longer distances they may need to make a stopover at intermediate airports. Thus, depending on the fuel capacity, a plane going from airport 2 to airport 3 in the figure might have to stop over at airport 1 (or the fuel capacity might be too low even to go to airport 1, in which case the trip would be impossible to make). We make the following simplifying assumptions: 1. The surface of the earth is a sphere of radius 6370 km. 2. Both time and fuel consumption are directly proportional to distance traveled. In other words we are interested only in total distance traveled. 3. The difference in distance caused by planes flying at different altitudes is negligible. Thus, eff\(ec- ti\)vely, we assume them to be flying along the earth’s surface. 4. A plane may stop for refueling at as many intermediate airports as needed, each time getting a full tank.

제약
입력 형식

The first line of each test case contains two integers \(N\) and \(R\), where \(2 \le N \le 25\) is the number of airports and \(1 \le R \le 10\,000\) is the maximum allowed flight distance (in km) from the nearest airport. Each of the next \(N\) lines contains two integers φ, θ satisfying 0 ≤φ < 360 a\(nd - 90\) ≤θ ≤90, the longitude and latitude (respectively) of an airport, in degrees. The airports are numbered according to their order in the input starting from one. No two airports are at the same position. Following this is a line containing an integer \(Q\), satisfying \(1 \le Q \le 100\). Each of the next \(Q\) lines contains three integers \(s\), \(t\), \(c\) satisfying \(1 \le s\), \(t \le N\), \(s\)̸ = \(t\), and \(1 \le c \le 50\,000\), indicating a plane going from airport \(s\) to airport \(t\) with a fuel capacity yielding a range of \(c\) km.

출력 형식

For each test case, display the case number followed by one line for each query containing the length in km of the shortest flight path between airport \(s\) and \(t\), subject to the fuel constraint \(c\). Display the length accurate to three decimal places. If there is no permissible path between the two airports, then display the word impossible instead. You may assume the answer is numerically stable for perturbations of up to 0.1 km of \(R\) or \(c\).

예제 1
입력
3 2000
0 0
0 30
30 0
3
2 3 5000
2 3 4000
2 3 3000
2 10000
45 45
225 -45
2
1 2 50000
2 1 50000
출력
Case 1:
4724.686
6670.648
impossible
Case 2:
impossible
impossible
문제 정보

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

출처 ICPC World Finals 2012

평가 및 의견

J. Shortest Flight Path

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

Log in to rate problems.

개별 의견

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

풀이 제출

J. Shortest Flight Path

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