(UVA) Oreon - Solution 1
Link to the problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3649 We want to determine a set of tunnels which has the least cost. Then, we can use a Minimum Spanning Tree to solve this problem. import java.io.*; import java.util.*; class Main { public ArrayList<Edge> list; public int[] nodeParent; public int[] depth; public int root(int n) { while (n != nodeParent[n]) { n = nodeParent[n]; } return n; } public boolean union(int n1, int n2) { int rootN1 = root(n1); int ...