結果
問題 | No.1254 補強への架け橋 |
ユーザー | marroncastle |
提出日時 | 2020-10-10 06:26:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 301 ms / 2,000 ms |
コード長 | 1,487 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 111,036 KB |
最終ジャッジ日時 | 2024-07-20 15:37:17 |
合計ジャッジ時間 | 21,017 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
53,888 KB |
testcase_01 | AC | 44 ms
54,016 KB |
testcase_02 | AC | 42 ms
53,504 KB |
testcase_03 | AC | 42 ms
53,888 KB |
testcase_04 | AC | 42 ms
53,376 KB |
testcase_05 | AC | 41 ms
53,504 KB |
testcase_06 | AC | 41 ms
53,888 KB |
testcase_07 | AC | 41 ms
54,144 KB |
testcase_08 | AC | 41 ms
53,888 KB |
testcase_09 | AC | 42 ms
54,144 KB |
testcase_10 | AC | 41 ms
53,888 KB |
testcase_11 | AC | 42 ms
54,016 KB |
testcase_12 | AC | 43 ms
53,760 KB |
testcase_13 | AC | 43 ms
54,144 KB |
testcase_14 | AC | 45 ms
53,888 KB |
testcase_15 | AC | 44 ms
53,888 KB |
testcase_16 | AC | 46 ms
53,888 KB |
testcase_17 | AC | 42 ms
54,272 KB |
testcase_18 | AC | 42 ms
54,016 KB |
testcase_19 | AC | 42 ms
54,016 KB |
testcase_20 | AC | 41 ms
54,272 KB |
testcase_21 | AC | 41 ms
54,016 KB |
testcase_22 | AC | 41 ms
53,504 KB |
testcase_23 | AC | 42 ms
54,144 KB |
testcase_24 | AC | 42 ms
54,272 KB |
testcase_25 | AC | 43 ms
54,136 KB |
testcase_26 | AC | 42 ms
54,016 KB |
testcase_27 | AC | 42 ms
54,016 KB |
testcase_28 | AC | 42 ms
53,760 KB |
testcase_29 | AC | 42 ms
54,144 KB |
testcase_30 | AC | 43 ms
54,016 KB |
testcase_31 | AC | 43 ms
54,528 KB |
testcase_32 | AC | 42 ms
54,016 KB |
testcase_33 | AC | 42 ms
54,528 KB |
testcase_34 | AC | 42 ms
53,760 KB |
testcase_35 | AC | 42 ms
54,272 KB |
testcase_36 | AC | 42 ms
54,144 KB |
testcase_37 | AC | 41 ms
53,760 KB |
testcase_38 | AC | 41 ms
54,016 KB |
testcase_39 | AC | 42 ms
54,016 KB |
testcase_40 | AC | 42 ms
54,144 KB |
testcase_41 | AC | 41 ms
53,888 KB |
testcase_42 | AC | 41 ms
54,144 KB |
testcase_43 | AC | 55 ms
64,640 KB |
testcase_44 | AC | 47 ms
60,672 KB |
testcase_45 | AC | 52 ms
61,824 KB |
testcase_46 | AC | 56 ms
64,768 KB |
testcase_47 | AC | 49 ms
61,696 KB |
testcase_48 | AC | 53 ms
64,128 KB |
testcase_49 | AC | 41 ms
54,528 KB |
testcase_50 | AC | 58 ms
65,664 KB |
testcase_51 | AC | 62 ms
66,816 KB |
testcase_52 | AC | 59 ms
66,304 KB |
testcase_53 | AC | 60 ms
64,640 KB |
testcase_54 | AC | 58 ms
66,304 KB |
testcase_55 | AC | 55 ms
64,896 KB |
testcase_56 | AC | 43 ms
54,528 KB |
testcase_57 | AC | 59 ms
63,872 KB |
testcase_58 | AC | 57 ms
64,000 KB |
testcase_59 | AC | 44 ms
54,272 KB |
testcase_60 | AC | 47 ms
60,928 KB |
testcase_61 | AC | 55 ms
64,768 KB |
testcase_62 | AC | 44 ms
54,400 KB |
testcase_63 | AC | 90 ms
78,592 KB |
testcase_64 | AC | 74 ms
74,752 KB |
testcase_65 | AC | 89 ms
78,080 KB |
testcase_66 | AC | 88 ms
77,568 KB |
testcase_67 | AC | 71 ms
72,576 KB |
testcase_68 | AC | 90 ms
78,132 KB |
testcase_69 | AC | 88 ms
78,592 KB |
testcase_70 | AC | 76 ms
74,624 KB |
testcase_71 | AC | 75 ms
74,880 KB |
testcase_72 | AC | 90 ms
78,208 KB |
testcase_73 | AC | 83 ms
77,432 KB |
testcase_74 | AC | 91 ms
78,080 KB |
testcase_75 | AC | 88 ms
77,952 KB |
testcase_76 | AC | 70 ms
69,760 KB |
testcase_77 | AC | 85 ms
77,952 KB |
testcase_78 | AC | 96 ms
78,464 KB |
testcase_79 | AC | 92 ms
78,724 KB |
testcase_80 | AC | 90 ms
78,552 KB |
testcase_81 | AC | 90 ms
78,592 KB |
testcase_82 | AC | 99 ms
79,104 KB |
testcase_83 | AC | 247 ms
98,112 KB |
testcase_84 | AC | 244 ms
97,144 KB |
testcase_85 | AC | 171 ms
88,384 KB |
testcase_86 | AC | 230 ms
94,612 KB |
testcase_87 | AC | 237 ms
95,972 KB |
testcase_88 | AC | 98 ms
79,804 KB |
testcase_89 | AC | 253 ms
98,020 KB |
testcase_90 | AC | 196 ms
90,040 KB |
testcase_91 | AC | 162 ms
87,552 KB |
testcase_92 | AC | 113 ms
80,640 KB |
testcase_93 | AC | 211 ms
93,940 KB |
testcase_94 | AC | 190 ms
92,496 KB |
testcase_95 | AC | 191 ms
91,948 KB |
testcase_96 | AC | 233 ms
96,376 KB |
testcase_97 | AC | 141 ms
85,972 KB |
testcase_98 | AC | 232 ms
96,456 KB |
testcase_99 | AC | 168 ms
89,440 KB |
testcase_100 | AC | 242 ms
98,596 KB |
testcase_101 | AC | 115 ms
80,768 KB |
testcase_102 | AC | 101 ms
80,000 KB |
testcase_103 | AC | 111 ms
80,976 KB |
testcase_104 | AC | 127 ms
84,480 KB |
testcase_105 | AC | 203 ms
93,724 KB |
testcase_106 | AC | 143 ms
87,156 KB |
testcase_107 | AC | 235 ms
97,684 KB |
testcase_108 | AC | 236 ms
97,340 KB |
testcase_109 | AC | 204 ms
93,800 KB |
testcase_110 | AC | 195 ms
91,724 KB |
testcase_111 | AC | 198 ms
92,592 KB |
testcase_112 | AC | 130 ms
83,968 KB |
testcase_113 | AC | 183 ms
91,388 KB |
testcase_114 | AC | 150 ms
86,992 KB |
testcase_115 | AC | 96 ms
79,488 KB |
testcase_116 | AC | 152 ms
88,348 KB |
testcase_117 | AC | 131 ms
84,096 KB |
testcase_118 | AC | 232 ms
96,552 KB |
testcase_119 | AC | 165 ms
89,036 KB |
testcase_120 | AC | 217 ms
95,584 KB |
testcase_121 | AC | 114 ms
81,024 KB |
testcase_122 | AC | 155 ms
88,064 KB |
testcase_123 | AC | 43 ms
54,016 KB |
testcase_124 | AC | 299 ms
111,036 KB |
testcase_125 | AC | 301 ms
110,904 KB |
ソースコード
import sys input = sys.stdin.readline from collections import deque class UnDirectedGraph: def __init__(self, N): self.V = N self.edge = [[] for _ in range(self.V)] self.edges = [0]*N self.visited = [False]*N self.parent = [N]*N self.order = [N]*N self.low = [N]*N def add_edges(self, M): for i in range(M): a,b = map(int, input().split()) self.edge[a-1].append((b-1,i)) self.edge[b-1].append((a-1,i)) self.edges[i] = (a-1,b-1) def add_edge(self, a, b): self.edge[a].append(b) self.edge[b].append(a) def low_link(self, start): stack = deque([start]) self.parent[start] = -1 #記録したい値の配列を定義 self.order[start] = 0 cnt = 1 while stack: v = stack[-1] for u,i in self.edge[v]: if u==self.parent[v]: pass elif self.order[u]<self.order[v]: self.low[v] = min(self.low[v], self.order[u]) elif self.parent[u]==N: #行き self.parent[u] = v self.order[u] = cnt self.low[u] = cnt stack.append(u) cnt += 1 break else: self.low[v] = min(self.low[v], self.low[u]) else: stack.pop() #帰り return N = int(input()) G = UnDirectedGraph(N) G.add_edges(N) G.low_link(0) ans = [] for i,(a,b) in enumerate(G.edges): if G.order[a]>G.order[b]: a,b = b,a if G.low[b]<=G.order[a]: ans.append(i+1) print(len(ans)) print(*ans)