IDNLearn.com provides a collaborative platform for sharing and gaining knowledge. Ask any question and receive comprehensive, well-informed responses from our dedicated team of experts.
Answer:
Output
43
Explanation : 0 -> 3 -> 0
Explanation:
Constraints
1 <= n <= 1000
1 <= m <= 2000
10 <= max_t <= 100
0 <= u[i], v[i] <= n-1
u[i] != v[i]
10 <= t[i] <= 100
0 <= beauty[i] <= 10^8
No more than 4 roads connect a single square with others
Two roads can be connected by at most 1 road
Example
n = 4
m = 3
max_t = 30
beauty = [5, 10, 15, 20]
u = [0, 1, 0]
v = [1, 2, 3]
t = [6, 7, 10]
Output
43
Explanation : 0 -> 3 -> 0