Prototype: implement prototype(int n, List<Edge> edges, int source) returning List<Long> with a direct baseline.
Final: implement solve(int n, List<Edge> edges, int source) with the mechanism and bounds described above. Directed weighted edges allow parallel edges, self-loops, and zero costs. Return minimum Long costs in vertex order and null for unreachable vertices. Reject n <= 0, invalid source/endpoints, and every negative edge weight, including unreachable ones. Both stages have the same observable contract. The prototype may use the simpler method; final must use the target data structure.
The supplied nested record types define the API. All methods are static members of Exercise.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.