Meeting Time
Time limit1sMemory limit256 MB
Find the smallest total travel time that both cows can achieve on separate downhill paths from field 1 to field N.
- Level
Medium5 of 10
- Topics
- Dynamic programming, Graph
- Solved
- No attempts yet
Problem
Bessie and Elsie travel downhill from field 1 to field on a DAG. Each path has Bessie time and Elsie time . Find the minimum time when both can arrive at field together, or IMPOSSIBLE.
Input
, , then lines with , , , ().
Output
Minimum equal arrival time, or IMPOSSIBLE.