Highlights
Puzzle
You need to redesign the road system of an imaginary country. The country is composed of N cities (for simplicity numbered from 0 to N — 1). Some pairs of cities are connected by bidirectional roads. We say that there is a path between different cities A and B if there exists a sequence of unique cities C1, C2, ... , CM, such that C1 = A and CM = B and for each index i < M, there is a road between cities CZ and Ci±i. The current state of the road network is miserable. Some pairs of cities are not connected by any path. On the other hand, other pairs of cities are connected by multiple different paths, and that leads to complicated traffic routing. You want to build some new roads and destroy some of the already existing roads in the country so that after the reconstruction there will exist exactly one path between every pair of distinct cities. As building new roads and destroying old ones costs a lot of money, you want to minimize the total cost spent on the reconstruction.
You are given three two-dimensional arrays:
• country [i] [ j ] =1 or 0: there is an existing road between city i and j if and only if country [i] [j ] =1.
• build [i] [j] : the cost for building a road between i and j. The values of build [i] [j] are represented using English letters. A, B,...,Z represent 0, 1, ... , 25 and a, b,...,z represent 26, 27, ... , 51. For example, if build [2] [4] =b, then that means the cost for building a road between city 2 and city 4 is
27.
• destroy [i] [j] : the cost for destroying a road between i and j. Again, the values are represented using English letters like the above.
Your task is to find and print the minimal cost needed for the road network reconstruction. You don't need to worry about invalid inputs.
This Computer Science Assignment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.