結果
問題 | No.1254 補強への架け橋 |
ユーザー | DrDrpilot |
提出日時 | 2022-01-29 12:55:23 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,023 ms / 2,000 ms |
コード長 | 1,422 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 76,288 KB |
最終ジャッジ日時 | 2024-06-10 10:49:07 |
合計ジャッジ時間 | 38,152 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
11,008 KB |
testcase_01 | AC | 30 ms
11,008 KB |
testcase_02 | AC | 30 ms
11,008 KB |
testcase_03 | AC | 30 ms
10,880 KB |
testcase_04 | AC | 31 ms
11,136 KB |
testcase_05 | AC | 30 ms
10,880 KB |
testcase_06 | AC | 31 ms
10,880 KB |
testcase_07 | AC | 30 ms
11,008 KB |
testcase_08 | AC | 31 ms
11,008 KB |
testcase_09 | AC | 30 ms
11,008 KB |
testcase_10 | AC | 31 ms
10,880 KB |
testcase_11 | AC | 31 ms
11,008 KB |
testcase_12 | AC | 30 ms
10,880 KB |
testcase_13 | AC | 31 ms
11,008 KB |
testcase_14 | AC | 30 ms
10,880 KB |
testcase_15 | AC | 32 ms
11,008 KB |
testcase_16 | AC | 31 ms
10,880 KB |
testcase_17 | AC | 30 ms
10,880 KB |
testcase_18 | AC | 30 ms
11,008 KB |
testcase_19 | AC | 30 ms
11,008 KB |
testcase_20 | AC | 31 ms
11,136 KB |
testcase_21 | AC | 30 ms
11,008 KB |
testcase_22 | AC | 31 ms
10,880 KB |
testcase_23 | AC | 30 ms
11,008 KB |
testcase_24 | AC | 31 ms
11,008 KB |
testcase_25 | AC | 30 ms
11,008 KB |
testcase_26 | AC | 31 ms
11,008 KB |
testcase_27 | AC | 31 ms
10,880 KB |
testcase_28 | AC | 31 ms
11,008 KB |
testcase_29 | AC | 30 ms
11,008 KB |
testcase_30 | AC | 30 ms
11,008 KB |
testcase_31 | AC | 32 ms
11,008 KB |
testcase_32 | AC | 30 ms
11,008 KB |
testcase_33 | AC | 31 ms
10,880 KB |
testcase_34 | AC | 30 ms
11,008 KB |
testcase_35 | AC | 31 ms
11,008 KB |
testcase_36 | AC | 30 ms
11,008 KB |
testcase_37 | AC | 30 ms
10,880 KB |
testcase_38 | AC | 31 ms
10,880 KB |
testcase_39 | AC | 30 ms
11,008 KB |
testcase_40 | AC | 30 ms
11,008 KB |
testcase_41 | AC | 30 ms
11,008 KB |
testcase_42 | AC | 30 ms
11,008 KB |
testcase_43 | AC | 36 ms
11,264 KB |
testcase_44 | AC | 32 ms
10,880 KB |
testcase_45 | AC | 32 ms
11,136 KB |
testcase_46 | AC | 36 ms
11,264 KB |
testcase_47 | AC | 33 ms
10,880 KB |
testcase_48 | AC | 35 ms
11,136 KB |
testcase_49 | AC | 32 ms
10,880 KB |
testcase_50 | AC | 37 ms
11,136 KB |
testcase_51 | AC | 35 ms
11,264 KB |
testcase_52 | AC | 37 ms
11,264 KB |
testcase_53 | AC | 35 ms
11,136 KB |
testcase_54 | AC | 36 ms
11,136 KB |
testcase_55 | AC | 36 ms
11,264 KB |
testcase_56 | AC | 33 ms
11,008 KB |
testcase_57 | AC | 35 ms
11,136 KB |
testcase_58 | AC | 36 ms
11,008 KB |
testcase_59 | AC | 31 ms
11,008 KB |
testcase_60 | AC | 33 ms
10,880 KB |
testcase_61 | AC | 36 ms
11,264 KB |
testcase_62 | AC | 32 ms
10,880 KB |
testcase_63 | AC | 98 ms
16,640 KB |
testcase_64 | AC | 48 ms
12,160 KB |
testcase_65 | AC | 74 ms
14,848 KB |
testcase_66 | AC | 65 ms
14,080 KB |
testcase_67 | AC | 44 ms
12,032 KB |
testcase_68 | AC | 67 ms
14,336 KB |
testcase_69 | AC | 79 ms
15,232 KB |
testcase_70 | AC | 50 ms
12,416 KB |
testcase_71 | AC | 46 ms
12,032 KB |
testcase_72 | AC | 80 ms
15,488 KB |
testcase_73 | AC | 48 ms
12,416 KB |
testcase_74 | AC | 76 ms
15,232 KB |
testcase_75 | AC | 66 ms
14,080 KB |
testcase_76 | AC | 38 ms
11,264 KB |
testcase_77 | AC | 60 ms
13,184 KB |
testcase_78 | AC | 88 ms
16,000 KB |
testcase_79 | AC | 92 ms
16,384 KB |
testcase_80 | AC | 84 ms
15,616 KB |
testcase_81 | AC | 93 ms
16,384 KB |
testcase_82 | AC | 87 ms
15,872 KB |
testcase_83 | AC | 980 ms
64,516 KB |
testcase_84 | AC | 962 ms
64,136 KB |
testcase_85 | AC | 570 ms
42,836 KB |
testcase_86 | AC | 790 ms
57,948 KB |
testcase_87 | AC | 891 ms
61,656 KB |
testcase_88 | AC | 128 ms
18,944 KB |
testcase_89 | AC | 948 ms
65,228 KB |
testcase_90 | AC | 572 ms
44,264 KB |
testcase_91 | AC | 460 ms
38,068 KB |
testcase_92 | AC | 232 ms
26,636 KB |
testcase_93 | AC | 755 ms
51,784 KB |
testcase_94 | AC | 652 ms
48,412 KB |
testcase_95 | AC | 647 ms
48,244 KB |
testcase_96 | AC | 899 ms
62,756 KB |
testcase_97 | AC | 375 ms
34,320 KB |
testcase_98 | AC | 923 ms
62,416 KB |
testcase_99 | AC | 532 ms
41,684 KB |
testcase_100 | AC | 987 ms
66,528 KB |
testcase_101 | AC | 220 ms
25,156 KB |
testcase_102 | AC | 116 ms
17,664 KB |
testcase_103 | AC | 235 ms
26,376 KB |
testcase_104 | AC | 314 ms
31,236 KB |
testcase_105 | AC | 760 ms
51,944 KB |
testcase_106 | AC | 410 ms
36,416 KB |
testcase_107 | AC | 938 ms
65,228 KB |
testcase_108 | AC | 947 ms
63,408 KB |
testcase_109 | AC | 739 ms
50,580 KB |
testcase_110 | AC | 646 ms
47,924 KB |
testcase_111 | AC | 720 ms
50,328 KB |
testcase_112 | AC | 295 ms
30,176 KB |
testcase_113 | AC | 629 ms
46,952 KB |
testcase_114 | AC | 396 ms
35,808 KB |
testcase_115 | AC | 143 ms
19,508 KB |
testcase_116 | AC | 475 ms
38,992 KB |
testcase_117 | AC | 294 ms
30,264 KB |
testcase_118 | AC | 902 ms
61,480 KB |
testcase_119 | AC | 522 ms
41,268 KB |
testcase_120 | AC | 870 ms
60,120 KB |
testcase_121 | AC | 257 ms
27,800 KB |
testcase_122 | AC | 483 ms
38,604 KB |
testcase_123 | AC | 30 ms
10,880 KB |
testcase_124 | AC | 1,023 ms
76,160 KB |
testcase_125 | AC | 1,008 ms
76,288 KB |
ソースコード
import sys sys.setrecursionlimit(10**6) 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)