아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Flygskam

시간 제한2초메모리 제한1024 MB

요약
구 위의 공항 좌표와 양방향 항공로가 주어질 때, 시작 공항에서 목표 공항까지 대권 거리에 편당 100의 패널티를 더한 최소 수치심을 구한다.
난이도

보통10점 중 7점

유형
최단 경로, 그래프, 기하
정답자
아직 제출이 없습니다

문제

At one of the many climate protests, Skylar fell in love with a fellow environmental activist. Unfortunately, the two young lovers live on opposite sides of the planet and long distance travel is only practical by (gasp) air. Skylar had scolded friends and family for flying, heavily handing out the recent Swedish export flygskam (verbatim translation: flight shame). But alas, the things we do for love! Now they want your help to calculate the minimum amount of flygskam Skylar will accumulate on a one-way trip across the globe. 

To calculate the best route you models the planet as a perfect sphere and assumes that all flights fly at the distance 63816381 km from the center of the earth. The amount of shame for a single point-to-point flight is calculated as the distance between the airports in km, plus a take-off and landing penalty of 100100, that is, two airports with the flight distance 10001000 km will result in 11001100 shame. 

The positions of the airports are given as the latitude and longitude in (decimal) degrees. The latitude of a point PP on the earths surface is the angle between the equatorial plane and a line passing through PP and the center of the earth. The equator has latitude 0∘0^\circ, points north of the equator has positive values and points south of the equator has negative values, the North Pole has latitude 90∘90^\circ and the South Pole latitude −90∘-90 ^\circ. Half circles that run from the North to the South pole are called meridians. The zero meridian runs through Greenwich. The longitude of a point QQ is the angle between the zero meridian plane and the line that run through QQ and the center of the earth, with values from −180∘- 180^\circ to +180∘+180^\circ, with positive values east of Greenwich.

입력

Input starts with one line with two integers 1≤N≤10,0001 \leq N \leq 10\\,000, the number of airports and 1≤M≤100,0001 \leq M \leq 100\\,000, the number of two-way flight routes. The second line has two strings SS and TT, Skylar's start position and Skylar's target position. Then follows NN lines, each starts with a three letter (uppercase) airport code, followed by two real values numbers, the latitude and longitude in degrees. Then follows MM lines, each with two strings aa and bb, the airports with a two-way flight connection. 

All flight airports have unique names and all connections are between existing airports.

출력

Output a real value with the minimum amount of flygskam Skylar will obtain on a one-way trip. If the target is unreachable and Skylar will be forever alone, output -1. Answers within a relative or absolute error of 10−610^{-6} will be accepted.

예제3

  1. 예제 1

    입력
    4 4
    ARN SCR
    ARN 59.6467921 17.9370443
    SCR 61.156603 12.837360
    CPH 55.618023 12.650763
    OSL 60.197646 11.100008
    ARN OSL
    ARN CPH
    SCR OSL
    OSL CPH
    
    예상 출력
    729.09706162045
    
  2. 예제 2

    입력
    2 1
    LAX AKL
    AKL -37.006131 174.783781
    LAX 33.941589 -118.408531
    LAX AKL
    
    예상 출력
    10603.3297338597
    
  3. 예제 3

    입력
    4 2
    CDG AKL
    AKL -37.006131 174.783781
    CDG 49.014490 2.542102
    DXB 25.253176 55.365673
    LAX 33.941589 -118.408531
    CDG LAX
    DXB AKL
    
    예상 출력
    -1