Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Consider what each city contributes to the total importance of all roads.
Based on that, how can you sort the cities such that assigning them values in that order will yield the maximum total importance?