Street racing
Practice
0 (0 votes)
Ready
Medium
Algorithms
Approved
Problem
91% Success 1459 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are taking part in a new street racing competition in your city! Your city can be considered as N points-crossings on the plane with M segments-roads connecting some pairs of the crossings. Start is placed at crossing S and finish at crossing F. Now you want to know the minimum distance you have to cover.

But there is one issue: you can not arbitrary switch roads in crossing because your speed is very high - 1 unit / 1 second. More precisely: you can drive on the road B-C after road A-B if angle between your old direction of movement and new direction of movement is less or equal to a degrees (otherwise this turn will be very dangerous and you have a risk of getting to ditch). Initially you can move from S in any direction.

So what is the minimum distance you have to drive in order to get from S to F?

Constraints

1 <= N <= 100
0 <= M <= N * (N-1) / 2
0 <= a <= 180
-10 000 <= x, y <= 10 000
1 <= S,F <= N

Input

The first line contains 3 space-separated integers: N, M, a
The second line contains 2 space-separated integers: S, F. The following N lines contain pair of integers x, y each and describe points corresponding to the crossings. The following M lines contain pair of integers q, w each and correspond to segment-road between crossings q and w. Crossings are enumerated from 1 to N.

Output

Output the minimum distance you have to drive with exactly 3 digits after decimal point or -1 if it's impossible to get from S to F.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
20 votes
Tags:
MathematicsApprovedVery-Easy
Points:30
Tags:
ImplementationBasic ProgrammingEasyStringBasics of Implementation
Points:30
21 votes
Tags:
Brute-force searchBitmaskDynamic ProgrammingApprovedEasy-Medium