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

Method main

src/class191/Code06_Network1.java:144–175  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

142 }
143
144 public static void main(String[] args) throws Exception {
145 FastReader in = new FastReader(System.in);
146 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
147 t = 0;
148 n = in.nextInt();
149 m = in.nextInt();
150 while (n != 0 || m != 0) {
151 prepare();
152 for (int i = 1; i <= m; i++) {
153 a[i] = in.nextInt();
154 b[i] = in.nextInt();
155 addEdge(a[i], b[i]);
156 addEdge(b[i], a[i]);
157 }
158 tarjan(1, 0);
159 condense();
160 dfs(1, 0);
161 out.println("Case " + (++t) + ":");
162 q = in.nextInt();
163 for (int i = 1, x, y; i <= q; i++) {
164 x = in.nextInt();
165 y = in.nextInt();
166 link(x, y);
167 out.println(ebccCnt - 1);
168 }
169 out.println();
170 n = in.nextInt();
171 m = in.nextInt();
172 }
173 out.flush();
174 out.close();
175 }
176
177 // 读写工具类
178 static class FastReader {

Callers

nothing calls this directly

Calls 10

nextIntMethod · 0.95
prepareMethod · 0.95
addEdgeMethod · 0.95
tarjanMethod · 0.95
condenseMethod · 0.95
dfsMethod · 0.95
linkMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected