KCM Travel
Time limit3sMemory limit256 MB
Find the fastest route from airport 1 to airport N using flights with costs and times without exceeding budget M, or report that it is impossible.
- Level
Medium6 of 10
- Topics
- Dynamic programming, Shortest path, Graph
- Solved
- No attempts yet
Problem
Chanmin qualified for Google Code Jam World Finals, but Google pays at most for travel. Given flights with cost and duration between airports, find the minimum travel time from airport 1 (Incheon) to airport (LA) with total cost at most . If impossible, print Poor KCM.
Input
- Line 1: integer (always 1)
- Per test: integers , , , then lines with , , ,
Output
For each test, print the minimum time, or Poor KCM if no route fits the budget.