I Was trying to solve 459E And Happened to get a Time limit in this Submission

What I'm Trying to do is Dynamic programming on edges Index

1-I Start at the first edge which I denote as (u,v,w)

2-I binary search on the all the edges going out of v and has weight higher than w(sorted edgeList before DP)

3-Try all those edges

I Might be miscalculating the complexity But I think it should be like O((n+m)logm)[This is not exact,but somewhere near that]

Hopefully someone can help me..

Thanks for your time.