結果
問題 | No.1254 補強への架け橋 |
ユーザー | tanon710 |
提出日時 | 2020-10-10 01:46:34 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,239 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 122,932 KB |
最終ジャッジ日時 | 2024-07-20 15:24:07 |
合計ジャッジ時間 | 25,235 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
51,840 KB |
testcase_01 | AC | 37 ms
52,480 KB |
testcase_02 | AC | 41 ms
52,096 KB |
testcase_03 | AC | 37 ms
51,840 KB |
testcase_04 | AC | 37 ms
51,968 KB |
testcase_05 | AC | 37 ms
52,096 KB |
testcase_06 | AC | 37 ms
51,840 KB |
testcase_07 | AC | 37 ms
52,096 KB |
testcase_08 | AC | 37 ms
52,096 KB |
testcase_09 | AC | 38 ms
52,096 KB |
testcase_10 | AC | 37 ms
52,352 KB |
testcase_11 | AC | 41 ms
52,096 KB |
testcase_12 | AC | 41 ms
52,224 KB |
testcase_13 | AC | 38 ms
52,608 KB |
testcase_14 | AC | 38 ms
52,736 KB |
testcase_15 | AC | 39 ms
52,608 KB |
testcase_16 | AC | 37 ms
52,224 KB |
testcase_17 | AC | 37 ms
52,352 KB |
testcase_18 | AC | 37 ms
52,224 KB |
testcase_19 | AC | 37 ms
52,480 KB |
testcase_20 | AC | 38 ms
52,352 KB |
testcase_21 | AC | 38 ms
52,352 KB |
testcase_22 | AC | 37 ms
52,608 KB |
testcase_23 | AC | 38 ms
52,608 KB |
testcase_24 | AC | 38 ms
52,864 KB |
testcase_25 | AC | 38 ms
52,352 KB |
testcase_26 | AC | 40 ms
52,864 KB |
testcase_27 | AC | 38 ms
52,480 KB |
testcase_28 | AC | 39 ms
52,864 KB |
testcase_29 | AC | 42 ms
52,352 KB |
testcase_30 | AC | 37 ms
52,352 KB |
testcase_31 | AC | 37 ms
52,864 KB |
testcase_32 | AC | 39 ms
52,352 KB |
testcase_33 | AC | 39 ms
52,992 KB |
testcase_34 | AC | 39 ms
52,992 KB |
testcase_35 | AC | 38 ms
52,864 KB |
testcase_36 | AC | 38 ms
52,864 KB |
testcase_37 | AC | 39 ms
52,608 KB |
testcase_38 | AC | 38 ms
52,608 KB |
testcase_39 | AC | 39 ms
52,736 KB |
testcase_40 | AC | 37 ms
52,736 KB |
testcase_41 | AC | 38 ms
52,480 KB |
testcase_42 | AC | 38 ms
52,480 KB |
testcase_43 | AC | 59 ms
64,384 KB |
testcase_44 | AC | 44 ms
54,272 KB |
testcase_45 | AC | 43 ms
54,400 KB |
testcase_46 | AC | 57 ms
63,488 KB |
testcase_47 | AC | 47 ms
55,424 KB |
testcase_48 | AC | 61 ms
65,536 KB |
testcase_49 | AC | 39 ms
52,992 KB |
testcase_50 | AC | 62 ms
65,408 KB |
testcase_51 | AC | 74 ms
66,048 KB |
testcase_52 | AC | 70 ms
68,352 KB |
testcase_53 | AC | 60 ms
64,256 KB |
testcase_54 | AC | 74 ms
67,712 KB |
testcase_55 | AC | 58 ms
63,488 KB |
testcase_56 | AC | 42 ms
53,376 KB |
testcase_57 | AC | 52 ms
61,568 KB |
testcase_58 | AC | 52 ms
61,184 KB |
testcase_59 | AC | 41 ms
52,736 KB |
testcase_60 | AC | 46 ms
54,016 KB |
testcase_61 | AC | 59 ms
63,232 KB |
testcase_62 | AC | 40 ms
53,248 KB |
testcase_63 | AC | 137 ms
80,000 KB |
testcase_64 | AC | 107 ms
77,568 KB |
testcase_65 | AC | 128 ms
78,976 KB |
testcase_66 | AC | 123 ms
78,592 KB |
testcase_67 | AC | 98 ms
77,168 KB |
testcase_68 | AC | 122 ms
78,592 KB |
testcase_69 | AC | 138 ms
79,240 KB |
testcase_70 | AC | 112 ms
77,568 KB |
testcase_71 | AC | 101 ms
77,552 KB |
testcase_72 | AC | 125 ms
79,232 KB |
testcase_73 | AC | 109 ms
78,208 KB |
testcase_74 | AC | 124 ms
79,488 KB |
testcase_75 | AC | 121 ms
78,592 KB |
testcase_76 | AC | 83 ms
74,880 KB |
testcase_77 | AC | 122 ms
78,592 KB |
testcase_78 | AC | 144 ms
79,728 KB |
testcase_79 | AC | 132 ms
79,684 KB |
testcase_80 | AC | 129 ms
79,504 KB |
testcase_81 | AC | 129 ms
80,416 KB |
testcase_82 | AC | 135 ms
79,488 KB |
testcase_83 | AC | 401 ms
121,280 KB |
testcase_84 | AC | 380 ms
118,484 KB |
testcase_85 | AC | 277 ms
104,156 KB |
testcase_86 | AC | 337 ms
112,708 KB |
testcase_87 | AC | 378 ms
117,376 KB |
testcase_88 | AC | 146 ms
81,664 KB |
testcase_89 | AC | 409 ms
121,624 KB |
testcase_90 | AC | 316 ms
105,640 KB |
testcase_91 | AC | 248 ms
99,328 KB |
testcase_92 | AC | 181 ms
87,680 KB |
testcase_93 | AC | 338 ms
112,880 KB |
testcase_94 | AC | 319 ms
108,868 KB |
testcase_95 | AC | 310 ms
108,176 KB |
testcase_96 | AC | 383 ms
118,676 KB |
testcase_97 | AC | 227 ms
94,336 KB |
testcase_98 | AC | 390 ms
117,564 KB |
testcase_99 | AC | 272 ms
101,488 KB |
testcase_100 | AC | 406 ms
122,932 KB |
testcase_101 | AC | 187 ms
86,312 KB |
testcase_102 | AC | 147 ms
80,940 KB |
testcase_103 | AC | 188 ms
87,808 KB |
testcase_104 | AC | 250 ms
92,084 KB |
testcase_105 | AC | 349 ms
112,160 KB |
testcase_106 | AC | 242 ms
97,792 KB |
testcase_107 | AC | 401 ms
122,196 KB |
testcase_108 | AC | 396 ms
122,840 KB |
testcase_109 | AC | 330 ms
112,236 KB |
testcase_110 | AC | 327 ms
108,856 KB |
testcase_111 | AC | 335 ms
109,868 KB |
testcase_112 | AC | 216 ms
91,524 KB |
testcase_113 | AC | 316 ms
108,652 KB |
testcase_114 | AC | 249 ms
96,512 KB |
testcase_115 | AC | 161 ms
82,760 KB |
testcase_116 | AC | 256 ms
98,944 KB |
testcase_117 | AC | 241 ms
91,056 KB |
testcase_118 | AC | 387 ms
118,548 KB |
testcase_119 | AC | 280 ms
101,844 KB |
testcase_120 | AC | 375 ms
117,152 KB |
testcase_121 | AC | 201 ms
88,156 KB |
testcase_122 | AC | 292 ms
99,128 KB |
testcase_123 | AC | 41 ms
51,968 KB |
testcase_124 | RE | - |
testcase_125 | RE | - |
ソースコード
class LowLink: def __init__(self, g): self.n=len(g) self.used=[0]*n self.ords=[0]*n self.lows=[0]*n self.aps=[] self.bridges=[] self.k=0 for i in range(self.n): if self.used[i]==0: self.k=self.dfs(i,self.k,-1) def dfs(self,id,k,par): self.used[id]=1 k+=1 self.ords[id]=k self.lows[id]=self.ords[id] is_aps=0 count=0 for v in g[id]: if self.used[v]==0: count+=1 k=self.dfs(v,k,id) self.lows[id]=min(self.lows[id],self.lows[v]) if par!=-1 and self.ords[id]<=self.lows[v]: is_aps=1 if self.ords[id]<self.lows[v]: self.bridges.append((min(id,v),max(id,v))) elif v!=par: self.lows[id]=min(self.lows[id],self.ords[v]) if par==-1 and count>=2: is_aps=1 if is_aps==1: self.aps.append(id) return k n=int(input()) g=[[] for _ in range(n)] edges=[] for i in range(1,n+1): a,b=map(int,input().split()) a-=1 b-=1 edges.append([a,b,i]) g[a].append(b) g[b].append(a) ll=LowLink(g) prior=set(ll.bridges) ans=[] for u,v,i in edges: if (u,v) in prior or (v,u) in prior: continue else: ans.append(i) print(len(ans)) print(*ans)