結果

問題 No.1254 補強への架け橋
ユーザー tanon710tanon710
提出日時 2020-10-10 01:45:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,241 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 115,816 KB
最終ジャッジ日時 2023-09-27 20:50:31
合計ジャッジ時間 17,152 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
76,004 KB
testcase_01 AC 64 ms
71,496 KB
testcase_02 AC 63 ms
71,316 KB
testcase_03 AC 63 ms
71,384 KB
testcase_04 AC 64 ms
71,500 KB
testcase_05 AC 62 ms
71,392 KB
testcase_06 AC 63 ms
71,324 KB
testcase_07 AC 63 ms
71,480 KB
testcase_08 AC 64 ms
71,268 KB
testcase_09 AC 65 ms
71,440 KB
testcase_10 AC 62 ms
71,376 KB
testcase_11 AC 63 ms
71,300 KB
testcase_12 AC 63 ms
71,496 KB
testcase_13 AC 65 ms
74,976 KB
testcase_14 AC 65 ms
74,888 KB
testcase_15 AC 66 ms
74,792 KB
testcase_16 AC 63 ms
71,472 KB
testcase_17 AC 63 ms
71,224 KB
testcase_18 AC 63 ms
71,492 KB
testcase_19 AC 64 ms
71,384 KB
testcase_20 AC 65 ms
74,840 KB
testcase_21 AC 60 ms
71,352 KB
testcase_22 AC 65 ms
74,756 KB
testcase_23 AC 66 ms
74,872 KB
testcase_24 AC 67 ms
74,636 KB
testcase_25 AC 65 ms
74,872 KB
testcase_26 AC 65 ms
75,016 KB
testcase_27 AC 66 ms
74,792 KB
testcase_28 AC 68 ms
74,880 KB
testcase_29 AC 66 ms
74,948 KB
testcase_30 AC 69 ms
71,260 KB
testcase_31 AC 66 ms
74,664 KB
testcase_32 AC 62 ms
71,328 KB
testcase_33 AC 65 ms
74,944 KB
testcase_34 AC 65 ms
74,868 KB
testcase_35 AC 65 ms
74,872 KB
testcase_36 AC 66 ms
74,876 KB
testcase_37 AC 68 ms
74,908 KB
testcase_38 AC 67 ms
74,844 KB
testcase_39 AC 66 ms
74,972 KB
testcase_40 AC 65 ms
74,756 KB
testcase_41 AC 64 ms
74,908 KB
testcase_42 AC 65 ms
74,940 KB
testcase_43 AC 81 ms
76,084 KB
testcase_44 AC 82 ms
74,936 KB
testcase_45 AC 69 ms
74,900 KB
testcase_46 AC 82 ms
75,892 KB
testcase_47 AC 72 ms
75,000 KB
testcase_48 AC 84 ms
76,384 KB
testcase_49 AC 67 ms
74,972 KB
testcase_50 AC 83 ms
76,492 KB
testcase_51 AC 82 ms
76,412 KB
testcase_52 AC 87 ms
76,604 KB
testcase_53 AC 80 ms
76,408 KB
testcase_54 AC 87 ms
76,424 KB
testcase_55 AC 79 ms
75,536 KB
testcase_56 AC 67 ms
74,948 KB
testcase_57 AC 74 ms
75,480 KB
testcase_58 AC 76 ms
75,340 KB
testcase_59 AC 67 ms
74,760 KB
testcase_60 AC 71 ms
74,956 KB
testcase_61 AC 79 ms
75,688 KB
testcase_62 AC 68 ms
74,912 KB
testcase_63 AC 369 ms
81,768 KB
testcase_64 AC 126 ms
78,824 KB
testcase_65 AC 216 ms
81,296 KB
testcase_66 AC 186 ms
80,820 KB
testcase_67 AC 116 ms
78,428 KB
testcase_68 AC 188 ms
80,328 KB
testcase_69 AC 231 ms
81,728 KB
testcase_70 AC 137 ms
78,620 KB
testcase_71 AC 126 ms
78,760 KB
testcase_72 AC 236 ms
81,932 KB
testcase_73 AC 134 ms
78,832 KB
testcase_74 AC 227 ms
80,428 KB
testcase_75 AC 184 ms
80,940 KB
testcase_76 AC 104 ms
78,204 KB
testcase_77 AC 166 ms
80,888 KB
testcase_78 AC 308 ms
82,292 KB
testcase_79 AC 290 ms
82,200 KB
testcase_80 AC 239 ms
81,412 KB
testcase_81 AC 284 ms
81,104 KB
testcase_82 AC 259 ms
81,200 KB
testcase_83 TLE -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
testcase_103 -- -
testcase_104 -- -
testcase_105 -- -
testcase_106 -- -
testcase_107 -- -
testcase_108 -- -
testcase_109 -- -
testcase_110 -- -
testcase_111 -- -
testcase_112 -- -
testcase_113 -- -
testcase_114 -- -
testcase_115 -- -
testcase_116 -- -
testcase_117 -- -
testcase_118 -- -
testcase_119 -- -
testcase_120 -- -
testcase_121 -- -
testcase_122 -- -
testcase_123 -- -
testcase_124 -- -
testcase_125 -- -
権限があれば一括ダウンロードができます

ソースコード

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=tuple(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