Minimum Total Toll for Reverse Road Traversals

Extend the previous problem: each directed road (u, v) has a non-negative toll c. Traveling along the direction is free; traveling against it (v -> u) costs that road's toll. Find the minimum to...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: