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

Method main

src/class196/Code06_Riddle1.java:152–188  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

150 }
151
152 public static void main(String[] args) throws Exception {
153 FastReader in = new FastReader(System.in);
154 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
155 n = in.nextInt();
156 m = in.nextInt();
157 k = in.nextInt();
158 cntt = n << 1;
159 for (int i = 1, u, v; i <= m; i++) {
160 u = in.nextInt();
161 v = in.nextInt();
162 addEdge(u + n, v);
163 addEdge(v + n, u);
164 }
165 for (int i = 1; i <= k; i++) {
166 w = in.nextInt();
167 for (int j = 1; j <= w; j++) {
168 arr[j] = in.nextInt();
169 }
170 link();
171 }
172 for (int i = 1; i <= cntt; i++) {
173 if (dfn[i] == 0) {
174 // tarjan1(i);
175 tarjan2(i);
176 }
177 }
178 boolean check = true;
179 for (int i = 1; i <= n; i++) {
180 if (belong[i] == belong[i + n]) {
181 check = false;
182 break;
183 }
184 }
185 out.println(check ? "TAK" : "NIE");
186 out.flush();
187 out.close();
188 }
189
190 // 读写工具类
191 static class FastReader {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected