結果
問題 | No.1254 補強への架け橋 |
ユーザー | tanon710 |
提出日時 | 2020-10-10 01:50:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 692 ms / 2,000 ms |
コード長 | 1,280 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 208,512 KB |
最終ジャッジ日時 | 2024-07-20 15:25:26 |
合計ジャッジ時間 | 27,887 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
51,968 KB |
testcase_01 | AC | 41 ms
52,480 KB |
testcase_02 | AC | 42 ms
51,840 KB |
testcase_03 | AC | 39 ms
51,968 KB |
testcase_04 | AC | 40 ms
52,096 KB |
testcase_05 | AC | 39 ms
52,096 KB |
testcase_06 | AC | 38 ms
52,224 KB |
testcase_07 | AC | 41 ms
52,480 KB |
testcase_08 | AC | 39 ms
52,096 KB |
testcase_09 | AC | 39 ms
52,096 KB |
testcase_10 | AC | 39 ms
51,968 KB |
testcase_11 | AC | 38 ms
52,352 KB |
testcase_12 | AC | 41 ms
51,968 KB |
testcase_13 | AC | 41 ms
52,736 KB |
testcase_14 | AC | 41 ms
52,352 KB |
testcase_15 | AC | 40 ms
52,224 KB |
testcase_16 | AC | 40 ms
52,352 KB |
testcase_17 | AC | 40 ms
51,712 KB |
testcase_18 | AC | 38 ms
51,968 KB |
testcase_19 | AC | 40 ms
51,968 KB |
testcase_20 | AC | 39 ms
52,608 KB |
testcase_21 | AC | 39 ms
52,096 KB |
testcase_22 | AC | 39 ms
52,736 KB |
testcase_23 | AC | 41 ms
52,608 KB |
testcase_24 | AC | 41 ms
52,864 KB |
testcase_25 | AC | 39 ms
52,608 KB |
testcase_26 | AC | 41 ms
52,736 KB |
testcase_27 | AC | 44 ms
52,352 KB |
testcase_28 | AC | 42 ms
52,480 KB |
testcase_29 | AC | 40 ms
52,736 KB |
testcase_30 | AC | 40 ms
52,096 KB |
testcase_31 | AC | 40 ms
52,480 KB |
testcase_32 | AC | 39 ms
52,352 KB |
testcase_33 | AC | 41 ms
53,120 KB |
testcase_34 | AC | 41 ms
52,480 KB |
testcase_35 | AC | 41 ms
52,608 KB |
testcase_36 | AC | 41 ms
52,736 KB |
testcase_37 | AC | 41 ms
52,736 KB |
testcase_38 | AC | 41 ms
52,480 KB |
testcase_39 | AC | 40 ms
51,968 KB |
testcase_40 | AC | 39 ms
52,096 KB |
testcase_41 | AC | 39 ms
52,352 KB |
testcase_42 | AC | 38 ms
52,352 KB |
testcase_43 | AC | 61 ms
64,256 KB |
testcase_44 | AC | 46 ms
54,400 KB |
testcase_45 | AC | 44 ms
54,272 KB |
testcase_46 | AC | 59 ms
63,232 KB |
testcase_47 | AC | 46 ms
55,040 KB |
testcase_48 | AC | 64 ms
65,408 KB |
testcase_49 | AC | 40 ms
52,608 KB |
testcase_50 | AC | 66 ms
65,152 KB |
testcase_51 | AC | 67 ms
65,920 KB |
testcase_52 | AC | 73 ms
68,096 KB |
testcase_53 | AC | 62 ms
64,384 KB |
testcase_54 | AC | 73 ms
67,840 KB |
testcase_55 | AC | 61 ms
62,720 KB |
testcase_56 | AC | 45 ms
52,736 KB |
testcase_57 | AC | 57 ms
60,928 KB |
testcase_58 | AC | 56 ms
61,184 KB |
testcase_59 | AC | 41 ms
52,736 KB |
testcase_60 | AC | 45 ms
54,016 KB |
testcase_61 | AC | 60 ms
63,104 KB |
testcase_62 | AC | 44 ms
52,992 KB |
testcase_63 | AC | 148 ms
79,744 KB |
testcase_64 | AC | 107 ms
77,952 KB |
testcase_65 | AC | 136 ms
79,232 KB |
testcase_66 | AC | 132 ms
78,464 KB |
testcase_67 | AC | 105 ms
77,696 KB |
testcase_68 | AC | 132 ms
78,336 KB |
testcase_69 | AC | 146 ms
79,872 KB |
testcase_70 | AC | 114 ms
77,568 KB |
testcase_71 | AC | 106 ms
77,696 KB |
testcase_72 | AC | 128 ms
79,360 KB |
testcase_73 | AC | 115 ms
77,824 KB |
testcase_74 | AC | 134 ms
79,360 KB |
testcase_75 | AC | 134 ms
78,464 KB |
testcase_76 | AC | 89 ms
74,752 KB |
testcase_77 | AC | 130 ms
78,080 KB |
testcase_78 | AC | 156 ms
79,616 KB |
testcase_79 | AC | 149 ms
79,488 KB |
testcase_80 | AC | 135 ms
79,360 KB |
testcase_81 | AC | 143 ms
80,128 KB |
testcase_82 | AC | 140 ms
79,232 KB |
testcase_83 | AC | 419 ms
121,216 KB |
testcase_84 | AC | 441 ms
118,528 KB |
testcase_85 | AC | 308 ms
104,192 KB |
testcase_86 | AC | 379 ms
113,152 KB |
testcase_87 | AC | 423 ms
116,736 KB |
testcase_88 | AC | 161 ms
81,792 KB |
testcase_89 | AC | 428 ms
121,088 KB |
testcase_90 | AC | 318 ms
105,472 KB |
testcase_91 | AC | 278 ms
99,328 KB |
testcase_92 | AC | 197 ms
87,424 KB |
testcase_93 | AC | 355 ms
113,024 KB |
testcase_94 | AC | 344 ms
108,672 KB |
testcase_95 | AC | 326 ms
107,904 KB |
testcase_96 | AC | 422 ms
118,272 KB |
testcase_97 | AC | 245 ms
94,080 KB |
testcase_98 | AC | 392 ms
117,376 KB |
testcase_99 | AC | 273 ms
101,120 KB |
testcase_100 | AC | 420 ms
123,264 KB |
testcase_101 | AC | 193 ms
86,400 KB |
testcase_102 | AC | 148 ms
80,512 KB |
testcase_103 | AC | 203 ms
87,936 KB |
testcase_104 | AC | 243 ms
91,648 KB |
testcase_105 | AC | 379 ms
111,616 KB |
testcase_106 | AC | 281 ms
97,280 KB |
testcase_107 | AC | 418 ms
122,240 KB |
testcase_108 | AC | 429 ms
122,368 KB |
testcase_109 | AC | 360 ms
112,640 KB |
testcase_110 | AC | 372 ms
108,928 KB |
testcase_111 | AC | 347 ms
109,824 KB |
testcase_112 | AC | 229 ms
91,008 KB |
testcase_113 | AC | 363 ms
107,776 KB |
testcase_114 | AC | 268 ms
96,512 KB |
testcase_115 | AC | 175 ms
82,816 KB |
testcase_116 | AC | 290 ms
98,560 KB |
testcase_117 | AC | 232 ms
91,392 KB |
testcase_118 | AC | 417 ms
117,760 KB |
testcase_119 | AC | 326 ms
101,632 KB |
testcase_120 | AC | 367 ms
117,120 KB |
testcase_121 | AC | 210 ms
88,320 KB |
testcase_122 | AC | 293 ms
99,456 KB |
testcase_123 | AC | 40 ms
51,712 KB |
testcase_124 | AC | 692 ms
202,240 KB |
testcase_125 | AC | 688 ms
208,512 KB |
ソースコード
import sys sys.setrecursionlimit(10**7) 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)