Edge Destruction
Practice
5 (1 votes)
Algorithms
Graphs
Medium
Problem
24% Success 346 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given a graph having N vertices and M bidirectional edges, with each edge having some length and some destruction cost. You have to increase the length of the shortest path between vertex 1 and vertex N, for that you can destroy some edges. Find the minimum cost of doing it.

Input Format:
First line consists of two space separated integers denoting N and M.
Following M lines consists of four space separated integers \(X \; Y \; D \; C\) denoting that there is an edge between vertex X and Y having length D and destruction cost C.

Output Format:
Print the required answer.

Constraints:
\(2 \le N \le 1000\)
\(1 \le M \le 4 \times 10^5\)
\(1 \le X, Y \le N\)
\(1 \le D, C \le 1000000\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
No similar problems found