(UVA) Audiophobia - Solution
Link to the problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=674&page=show_problem&problem=989 For this problem, we need to generate the Minimum Spanning Tree (MST). Then, for every edge (street) that we use, we need to keep that one that has the biggest value (decibels). import java.io.*; import java.util.*; class Main { public ArrayList<ArrayList<Edge>> adjList; public int prim(int start, int end) { Queue<Edge> queue = new PriorityQueue<>(); queue.add(new Edge(start, 0)); HashSet<Integer> visited = new HashSet<>(); int maxSoundIntensity = 0; ...