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

Method main

src/class191/Code01_CutEdge1.java:131–164  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

129 }
130
131 public static void main(String[] args) throws Exception {
132 FastReader in = new FastReader(System.in);
133 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
134 cntg = 1;
135 n = in.nextInt();
136 m = in.nextInt();
137 for (int i = 1, u, v; i <= m; i++) {
138 u = in.nextInt();
139 v = in.nextInt();
140 addEdge(u, v);
141 addEdge(v, u);
142 }
143 for (int i = 1; i <= n; i++) {
144 if (dfn[i] == 0) {
145 // tarjan1(i, 0);
146 tarjan2(i, 0);
147 }
148 }
149 int ansCnt = 0;
150 for (int i = 1; i <= m; i++) {
151 if (cutEdge[i]) {
152 ansCnt++;
153 }
154 }
155 out.println(ansCnt);
156 for (int i = 1; i <= m; i++) {
157 if (cutEdge[i]) {
158 out.print(i + " ");
159 }
160 }
161 out.println();
162 out.flush();
163 out.close();
164 }
165
166 // 读写工具类
167 static class FastReader {

Callers

nothing calls this directly

Calls 7

nextIntMethod · 0.95
addEdgeMethod · 0.95
tarjan2Method · 0.95
printlnMethod · 0.45
printMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected