結果
問題 | No.1254 補強への架け橋 |
ユーザー | DrDrpilot |
提出日時 | 2022-01-29 12:53:58 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,382 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 66,504 KB |
最終ジャッジ日時 | 2024-06-10 10:47:29 |
合計ジャッジ時間 | 32,339 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
11,008 KB |
testcase_01 | AC | 30 ms
10,880 KB |
testcase_02 | AC | 28 ms
10,880 KB |
testcase_03 | AC | 27 ms
11,008 KB |
testcase_04 | AC | 29 ms
10,880 KB |
testcase_05 | AC | 26 ms
10,880 KB |
testcase_06 | AC | 27 ms
11,008 KB |
testcase_07 | AC | 26 ms
11,008 KB |
testcase_08 | AC | 26 ms
11,008 KB |
testcase_09 | AC | 27 ms
11,136 KB |
testcase_10 | AC | 27 ms
11,008 KB |
testcase_11 | AC | 26 ms
10,880 KB |
testcase_12 | AC | 26 ms
10,880 KB |
testcase_13 | AC | 27 ms
11,008 KB |
testcase_14 | AC | 26 ms
10,880 KB |
testcase_15 | AC | 27 ms
10,880 KB |
testcase_16 | AC | 26 ms
10,880 KB |
testcase_17 | AC | 26 ms
10,880 KB |
testcase_18 | AC | 26 ms
11,008 KB |
testcase_19 | AC | 28 ms
10,880 KB |
testcase_20 | AC | 28 ms
11,008 KB |
testcase_21 | AC | 27 ms
10,880 KB |
testcase_22 | AC | 27 ms
11,008 KB |
testcase_23 | AC | 26 ms
10,880 KB |
testcase_24 | AC | 26 ms
11,008 KB |
testcase_25 | AC | 27 ms
10,880 KB |
testcase_26 | AC | 27 ms
10,880 KB |
testcase_27 | AC | 27 ms
10,880 KB |
testcase_28 | AC | 28 ms
11,008 KB |
testcase_29 | AC | 26 ms
10,880 KB |
testcase_30 | AC | 28 ms
10,880 KB |
testcase_31 | AC | 27 ms
11,008 KB |
testcase_32 | AC | 28 ms
11,136 KB |
testcase_33 | AC | 28 ms
11,008 KB |
testcase_34 | AC | 26 ms
10,880 KB |
testcase_35 | AC | 27 ms
11,008 KB |
testcase_36 | AC | 28 ms
10,880 KB |
testcase_37 | AC | 27 ms
11,008 KB |
testcase_38 | AC | 26 ms
10,880 KB |
testcase_39 | AC | 26 ms
10,880 KB |
testcase_40 | AC | 27 ms
10,880 KB |
testcase_41 | AC | 27 ms
11,008 KB |
testcase_42 | AC | 27 ms
10,880 KB |
testcase_43 | AC | 34 ms
11,136 KB |
testcase_44 | AC | 29 ms
10,880 KB |
testcase_45 | AC | 32 ms
10,880 KB |
testcase_46 | AC | 33 ms
11,136 KB |
testcase_47 | AC | 30 ms
11,008 KB |
testcase_48 | AC | 33 ms
11,008 KB |
testcase_49 | AC | 27 ms
11,008 KB |
testcase_50 | AC | 32 ms
11,136 KB |
testcase_51 | AC | 32 ms
11,264 KB |
testcase_52 | AC | 33 ms
11,136 KB |
testcase_53 | AC | 35 ms
11,136 KB |
testcase_54 | AC | 35 ms
11,136 KB |
testcase_55 | AC | 34 ms
11,136 KB |
testcase_56 | AC | 28 ms
11,008 KB |
testcase_57 | AC | 31 ms
11,008 KB |
testcase_58 | AC | 31 ms
11,008 KB |
testcase_59 | AC | 27 ms
11,008 KB |
testcase_60 | AC | 28 ms
11,008 KB |
testcase_61 | AC | 31 ms
11,264 KB |
testcase_62 | AC | 27 ms
11,008 KB |
testcase_63 | AC | 87 ms
16,640 KB |
testcase_64 | AC | 47 ms
12,288 KB |
testcase_65 | AC | 65 ms
14,720 KB |
testcase_66 | AC | 62 ms
13,952 KB |
testcase_67 | AC | 41 ms
11,904 KB |
testcase_68 | AC | 61 ms
14,336 KB |
testcase_69 | AC | 69 ms
15,232 KB |
testcase_70 | AC | 48 ms
12,416 KB |
testcase_71 | AC | 42 ms
12,032 KB |
testcase_72 | AC | 75 ms
15,360 KB |
testcase_73 | AC | 44 ms
12,288 KB |
testcase_74 | AC | 72 ms
15,232 KB |
testcase_75 | AC | 62 ms
14,080 KB |
testcase_76 | AC | 37 ms
11,392 KB |
testcase_77 | AC | 58 ms
13,184 KB |
testcase_78 | AC | 91 ms
16,128 KB |
testcase_79 | AC | 92 ms
16,256 KB |
testcase_80 | AC | 74 ms
15,616 KB |
testcase_81 | AC | 82 ms
16,256 KB |
testcase_82 | AC | 77 ms
16,000 KB |
testcase_83 | AC | 842 ms
64,540 KB |
testcase_84 | AC | 784 ms
64,312 KB |
testcase_85 | AC | 446 ms
42,836 KB |
testcase_86 | AC | 698 ms
57,964 KB |
testcase_87 | AC | 744 ms
61,796 KB |
testcase_88 | AC | 112 ms
18,816 KB |
testcase_89 | AC | 821 ms
65,264 KB |
testcase_90 | AC | 505 ms
44,264 KB |
testcase_91 | AC | 380 ms
37,936 KB |
testcase_92 | AC | 230 ms
26,640 KB |
testcase_93 | AC | 669 ms
51,908 KB |
testcase_94 | AC | 585 ms
48,228 KB |
testcase_95 | AC | 568 ms
48,172 KB |
testcase_96 | AC | 806 ms
62,732 KB |
testcase_97 | AC | 323 ms
34,312 KB |
testcase_98 | AC | 789 ms
62,344 KB |
testcase_99 | AC | 441 ms
41,684 KB |
testcase_100 | AC | 848 ms
66,504 KB |
testcase_101 | AC | 173 ms
25,148 KB |
testcase_102 | AC | 96 ms
17,664 KB |
testcase_103 | AC | 186 ms
26,380 KB |
testcase_104 | AC | 262 ms
31,240 KB |
testcase_105 | AC | 615 ms
51,820 KB |
testcase_106 | AC | 334 ms
36,292 KB |
testcase_107 | AC | 794 ms
65,164 KB |
testcase_108 | AC | 797 ms
63,612 KB |
testcase_109 | AC | 593 ms
50,460 KB |
testcase_110 | AC | 518 ms
47,796 KB |
testcase_111 | AC | 588 ms
49,200 KB |
testcase_112 | AC | 247 ms
30,176 KB |
testcase_113 | AC | 527 ms
46,880 KB |
testcase_114 | AC | 322 ms
35,552 KB |
testcase_115 | AC | 124 ms
19,456 KB |
testcase_116 | AC | 410 ms
39,112 KB |
testcase_117 | AC | 256 ms
30,264 KB |
testcase_118 | AC | 766 ms
61,556 KB |
testcase_119 | AC | 441 ms
41,264 KB |
testcase_120 | AC | 744 ms
60,040 KB |
testcase_121 | AC | 225 ms
27,928 KB |
testcase_122 | AC | 404 ms
38,608 KB |
testcase_123 | AC | 27 ms
11,136 KB |
testcase_124 | RE | - |
testcase_125 | RE | - |
ソースコード
def construct(G, N): P = [0]*N G0 = [[] for i in range(N)] V = [] lb = [0]*N def dfs(v, p): P[v] = p V.append(v) lb[v] = len(V) for w in G[v]: if w == p: continue if lb[w]: if lb[v] < lb[w]: G0[v].append(w) continue dfs(w, v) dfs(0, -1) B = [] ap = [0]*N used = [0]*N first = 1 used[0] = 1 for u in V: if not used[u]: p = P[u] B.append((u, p) if u < p else (p, u)) if len(G[u]) > 1: ap[u] = 1 if len(G[p]) > 1: ap[p] = 1 cycle = 0 for v in G0[u]: w = v while w != u and not used[w]: used[w] = 1 w = P[w] if w == u: cycle = 1 if cycle: if not first: ap[u] = 1 first = 0 A = [v for v in range(N) if ap[v]] return B n=int(input()) g=[[] for _ in range(n)] bridge=[] for _ in range(n): a,b=map(int,input().split()) g[a-1].append(b-1) g[b-1].append(a-1) if a>b: a,b=b,a bridge.append((a-1,b-1)) l=construct(g,n) l=set(l) ans=[] for i in range(n): if bridge[i] not in l: ans.append(i+1) print(len(ans)) print(*ans)