MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / main

Method main

src/class184/Code02_Difficult1.java:302–324  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

300 }
301
302 public static void main(String[] args) throws Exception {
303 FastReader in = new FastReader(System.in);
304 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
305 n = in.nextInt();
306 m = in.nextInt();
307 limitl = in.nextInt();
308 limitr = in.nextInt();
309 for (int i = 1; i <= m; i++) {
310 val[i] = in.nextInt();
311 }
312 for (int i = 1, u, v, c; i < n; i++) {
313 u = in.nextInt();
314 v = in.nextInt();
315 c = in.nextInt();
316 addEdge(u, v, c);
317 addEdge(v, u, c);
318 }
319 build(preTree, 0, n, 1);
320 build(curTree, 0, n, 1);
321 out.println(solve(getCentroid(1, 0)));
322 out.flush();
323 out.close();
324 }
325
326 // 读写工具类
327 static class FastReader {

Callers

nothing calls this directly

Calls 8

nextIntMethod · 0.95
addEdgeMethod · 0.95
buildMethod · 0.95
solveMethod · 0.95
getCentroidMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected