結果

問題 No.1254 補強への架け橋
ユーザー tanon710tanon710
提出日時 2020-10-10 01:46:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,239 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 86,528 KB
実行使用メモリ 125,020 KB
最終ジャッジ日時 2023-09-27 20:51:47
合計ジャッジ時間 31,885 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,336 KB
testcase_01 AC 67 ms
71,240 KB
testcase_02 AC 67 ms
71,160 KB
testcase_03 AC 72 ms
71,184 KB
testcase_04 AC 71 ms
71,220 KB
testcase_05 AC 70 ms
71,320 KB
testcase_06 AC 69 ms
71,120 KB
testcase_07 AC 69 ms
71,284 KB
testcase_08 AC 69 ms
71,216 KB
testcase_09 AC 67 ms
71,236 KB
testcase_10 AC 70 ms
71,248 KB
testcase_11 AC 69 ms
70,972 KB
testcase_12 AC 67 ms
71,224 KB
testcase_13 AC 69 ms
71,252 KB
testcase_14 AC 70 ms
71,248 KB
testcase_15 AC 69 ms
71,244 KB
testcase_16 AC 69 ms
71,412 KB
testcase_17 AC 66 ms
71,088 KB
testcase_18 AC 67 ms
71,252 KB
testcase_19 AC 67 ms
71,268 KB
testcase_20 AC 67 ms
71,244 KB
testcase_21 AC 67 ms
71,088 KB
testcase_22 AC 68 ms
70,892 KB
testcase_23 AC 69 ms
71,112 KB
testcase_24 AC 68 ms
71,124 KB
testcase_25 AC 69 ms
70,968 KB
testcase_26 AC 70 ms
71,212 KB
testcase_27 AC 69 ms
71,248 KB
testcase_28 AC 67 ms
71,244 KB
testcase_29 AC 68 ms
71,092 KB
testcase_30 AC 70 ms
71,184 KB
testcase_31 AC 69 ms
71,296 KB
testcase_32 AC 67 ms
71,152 KB
testcase_33 AC 69 ms
71,248 KB
testcase_34 AC 72 ms
71,284 KB
testcase_35 AC 68 ms
71,264 KB
testcase_36 AC 68 ms
71,088 KB
testcase_37 AC 70 ms
70,916 KB
testcase_38 AC 71 ms
71,248 KB
testcase_39 AC 67 ms
70,932 KB
testcase_40 AC 66 ms
71,164 KB
testcase_41 AC 70 ms
71,148 KB
testcase_42 AC 68 ms
71,064 KB
testcase_43 AC 92 ms
75,388 KB
testcase_44 AC 72 ms
71,116 KB
testcase_45 AC 73 ms
71,284 KB
testcase_46 AC 91 ms
75,464 KB
testcase_47 AC 74 ms
71,280 KB
testcase_48 AC 91 ms
76,136 KB
testcase_49 AC 68 ms
71,292 KB
testcase_50 AC 86 ms
75,844 KB
testcase_51 AC 88 ms
75,936 KB
testcase_52 AC 92 ms
76,192 KB
testcase_53 AC 85 ms
75,788 KB
testcase_54 AC 90 ms
76,028 KB
testcase_55 AC 82 ms
75,164 KB
testcase_56 AC 70 ms
71,280 KB
testcase_57 AC 78 ms
75,320 KB
testcase_58 AC 77 ms
74,804 KB
testcase_59 AC 67 ms
71,344 KB
testcase_60 AC 71 ms
71,156 KB
testcase_61 AC 82 ms
75,288 KB
testcase_62 AC 71 ms
71,260 KB
testcase_63 AC 184 ms
81,960 KB
testcase_64 AC 126 ms
78,648 KB
testcase_65 AC 152 ms
81,244 KB
testcase_66 AC 144 ms
80,644 KB
testcase_67 AC 119 ms
78,412 KB
testcase_68 AC 149 ms
79,972 KB
testcase_69 AC 156 ms
81,232 KB
testcase_70 AC 129 ms
78,880 KB
testcase_71 AC 123 ms
78,292 KB
testcase_72 AC 146 ms
81,564 KB
testcase_73 AC 131 ms
79,096 KB
testcase_74 AC 143 ms
80,532 KB
testcase_75 AC 146 ms
80,532 KB
testcase_76 AC 108 ms
78,052 KB
testcase_77 AC 143 ms
80,884 KB
testcase_78 AC 171 ms
82,200 KB
testcase_79 AC 156 ms
82,260 KB
testcase_80 AC 150 ms
81,260 KB
testcase_81 AC 154 ms
81,020 KB
testcase_82 AC 152 ms
81,128 KB
testcase_83 AC 433 ms
124,424 KB
testcase_84 AC 417 ms
120,712 KB
testcase_85 AC 327 ms
106,384 KB
testcase_86 AC 389 ms
114,352 KB
testcase_87 AC 430 ms
120,436 KB
testcase_88 AC 170 ms
84,688 KB
testcase_89 AC 450 ms
124,656 KB
testcase_90 AC 321 ms
106,848 KB
testcase_91 AC 282 ms
102,588 KB
testcase_92 AC 213 ms
88,864 KB
testcase_93 AC 369 ms
113,732 KB
testcase_94 AC 365 ms
110,200 KB
testcase_95 AC 351 ms
110,868 KB
testcase_96 AC 408 ms
119,972 KB
testcase_97 AC 262 ms
97,156 KB
testcase_98 AC 431 ms
119,856 KB
testcase_99 AC 311 ms
103,588 KB
testcase_100 AC 467 ms
125,020 KB
testcase_101 AC 208 ms
87,860 KB
testcase_102 AC 168 ms
82,608 KB
testcase_103 AC 216 ms
90,344 KB
testcase_104 AC 257 ms
93,360 KB
testcase_105 AC 380 ms
113,800 KB
testcase_106 AC 279 ms
99,640 KB
testcase_107 AC 449 ms
123,844 KB
testcase_108 AC 432 ms
124,064 KB
testcase_109 AC 353 ms
113,084 KB
testcase_110 AC 351 ms
110,328 KB
testcase_111 AC 358 ms
111,728 KB
testcase_112 AC 241 ms
93,288 KB
testcase_113 AC 376 ms
110,796 KB
testcase_114 AC 299 ms
99,652 KB
testcase_115 AC 184 ms
84,908 KB
testcase_116 AC 301 ms
101,252 KB
testcase_117 AC 240 ms
92,760 KB
testcase_118 AC 418 ms
119,592 KB
testcase_119 AC 309 ms
102,672 KB
testcase_120 AC 409 ms
119,012 KB
testcase_121 AC 220 ms
89,972 KB
testcase_122 AC 296 ms
102,360 KB
testcase_123 AC 66 ms
71,268 KB
testcase_124 RE -
testcase_125 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0