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

Method solve

src/class184/Code02_Difficult1.java:290–300  ·  view source on GitHub ↗
(int u)

Source from the content-addressed store, hash-verified

288 }
289
290 public static long solve(int u) {
291 vis[u] = true;
292 long ans = calc(u);
293 for (int e = head[u]; e > 0; e = nxt[e]) {
294 int v = to[e];
295 if (!vis[v]) {
296 ans = Math.max(ans, solve(getCentroid(v, u)));
297 }
298 }
299 return ans;
300 }
301
302 public static void main(String[] args) throws Exception {
303 FastReader in = new FastReader(System.in);

Callers 1

mainMethod · 0.95

Calls 3

calcMethod · 0.95
getCentroidMethod · 0.95
maxMethod · 0.45

Tested by

no test coverage detected