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

Method main

src/class195/Code09_Jail1.java:263–294  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

261 }
262
263 public static void main(String[] args) throws Exception {
264 FastReader in = new FastReader(System.in);
265 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
266 t = in.nextInt();
267 for (int c = 1; c <= t; c++) {
268 n = in.nextInt();
269 cntt = n << 1;
270 for (int i = 1; i <= n; i++) {
271 startTag[i] = i;
272 endTag[i] = i + n;
273 }
274 for (int i = 1, u, v; i < n; i++) {
275 u = in.nextInt();
276 v = in.nextInt();
277 addEdge1(u, v);
278 addEdge1(v, u);
279 }
280 // build1(1, 1);
281 build2(1, 1);
282 m = in.nextInt();
283 for (int i = 1, x, y; i <= m; i++) {
284 x = in.nextInt();
285 y = in.nextInt();
286 link(x, y);
287 }
288 boolean ans = topo();
289 out.println(ans ? "Yes" : "No");
290 clear();
291 }
292 out.flush();
293 out.close();
294 }
295
296 // 读写工具类
297 static class FastReader {

Callers

nothing calls this directly

Calls 9

nextIntMethod · 0.95
addEdge1Method · 0.95
build2Method · 0.95
linkMethod · 0.95
topoMethod · 0.95
clearMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected