Can someone help me solving this?
Difference between en1 and en2, changed 40 character(s)
There is a network of interconnected water pipes such that:↵

-There is no more than one pipe connecting two intersections1. ↵
-There is no pipe that loops around to the same intersection↵
-The time taken by water to flow through a pipe is equal to the length of the pipe and is the same in both directions↵
At every intersection there is a valve such that:↵

The valve opens at specific intervals, say after every T seconds↵
The time interval T is different for each intersection↵
Water can only flow through an intersection when the valve is open↵
If water arrives when the valve is closed, then it stops till the valve opens again↵
If water arrives at the intersection at the exact time the valve is open then it flows without delay↵
Input Format↵

First line contains two integers: source and destination intersections↵
Second line contains two integers: X (total number of intersections) & Y (total number of pipes)↵
Third line contains X integers, specifying the time interval T for each intersection↵
Next Y lines contain 3 integers each, specifying details of each pipe — the two intersections that the pipe connects, as well as the length L of the pipe↵
Output Format A single integer which is the time taken by water to flow between the source and destination intersections↵


~~~~~↵
Example Input 1:↵
1 6↵
6 8↵
6 4 2 5 4 8↵
1 2 3↵
1 3 7↵
2 3 4↵
2 4 10↵
3 5 8↵
4 5 3↵
4 6 10↵
5 6 6↵
Example Output 1: 22↵
~~~~~↵




~~~~~

Example Input 2:↵
1 5↵
5 6↵
5 3 7 2 10↵
1 2 10↵
1 3 2↵
2 5 10↵
2 4 2↵
3 5 18↵
4 5 3↵

Example Output 2: 17

~~~~~↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English fimaji1688 2021-09-16 13:07:14 40
en1 English fimaji1688 2021-09-16 13:06:31 1559 Initial revision (published)