Question: give the code in c + + , read the imput and ouput format properly, dont copy paste from anywhere, You need to travel from
give the code in c read the imput and ouput format properly, dont copy paste from anywhere, You need to travel from city to city across a land divided into cities
connected by undirected roads. Each road between cities and
has certain constraints, characterized by entities each with resistance points. The
travel time to cross this road at time depends on these constraints: it takes
time units to overcome the entities and move on to city where the division is done
using integer division. You can start your journey at time or any integer time unit
thereafter, and you can wait at any city for any integer amount of time. The goal is to
minimize the overall journey time. If it is not possible to reach city the result should
be The task is to find the minimum time required to complete your journey.
Input :
First line of input consists of and
The next lines contain the description of the undirected roads.
The line consists of
:
Output :
Print the minimum time possible according to the problem statement.
Examples
Input :
Output :
By selecting the second road that links city to city and initiating the journey from
city at time you can arrive in city with a calculated time of
units, where the division is integer division. Thus, the minimal travel time required to
reach city is units.
Input :
Output :
Hint :
is the time when you depart from city for city
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
