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

Method query

src/class201/Code07_Network1.java:229–237  ·  view source on GitHub ↗
(int c, int x, int y)

Source from the content-addressed store, hash-verified

227 }
228
229 public static int query(int c, int x, int y) {
230 int u = node(c, x);
231 int v = node(c, y);
232 if (findroot(u) != findroot(v)) {
233 return -1;
234 }
235 split(u, v);
236 return maxv[v];
237 }
238
239 public static void main(String[] args) throws Exception {
240 FastReader in = new FastReader(System.in);

Callers 1

mainMethod · 0.95

Calls 3

nodeMethod · 0.95
findrootMethod · 0.95
splitMethod · 0.95

Tested by

no test coverage detected