結果

問題 No.1254 補強への架け橋
ユーザー KudeKude
提出日時 2020-10-09 22:55:51
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 131,104 KB
最終ジャッジ日時 2023-09-27 19:03:47
合計ジャッジ時間 32,415 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,164 KB
testcase_01 AC 67 ms
71,328 KB
testcase_02 AC 66 ms
71,116 KB
testcase_03 AC 64 ms
71,156 KB
testcase_04 AC 66 ms
71,000 KB
testcase_05 AC 66 ms
71,160 KB
testcase_06 AC 64 ms
71,396 KB
testcase_07 AC 65 ms
70,952 KB
testcase_08 AC 64 ms
71,228 KB
testcase_09 AC 65 ms
71,324 KB
testcase_10 AC 66 ms
71,124 KB
testcase_11 AC 65 ms
71,396 KB
testcase_12 AC 64 ms
71,236 KB
testcase_13 AC 65 ms
71,116 KB
testcase_14 AC 68 ms
71,248 KB
testcase_15 AC 65 ms
71,224 KB
testcase_16 AC 66 ms
71,136 KB
testcase_17 AC 66 ms
71,360 KB
testcase_18 AC 65 ms
71,208 KB
testcase_19 AC 66 ms
71,236 KB
testcase_20 AC 67 ms
71,532 KB
testcase_21 AC 67 ms
71,268 KB
testcase_22 AC 68 ms
71,248 KB
testcase_23 AC 66 ms
71,324 KB
testcase_24 AC 68 ms
71,120 KB
testcase_25 AC 68 ms
71,188 KB
testcase_26 AC 66 ms
71,316 KB
testcase_27 AC 67 ms
71,116 KB
testcase_28 AC 69 ms
71,376 KB
testcase_29 AC 66 ms
71,448 KB
testcase_30 AC 66 ms
71,232 KB
testcase_31 AC 67 ms
71,112 KB
testcase_32 AC 69 ms
71,316 KB
testcase_33 AC 68 ms
71,336 KB
testcase_34 AC 67 ms
71,404 KB
testcase_35 AC 70 ms
71,156 KB
testcase_36 AC 69 ms
71,320 KB
testcase_37 AC 66 ms
71,400 KB
testcase_38 AC 65 ms
71,348 KB
testcase_39 AC 68 ms
71,240 KB
testcase_40 AC 66 ms
70,996 KB
testcase_41 AC 69 ms
71,492 KB
testcase_42 AC 75 ms
71,272 KB
testcase_43 AC 82 ms
75,724 KB
testcase_44 AC 72 ms
71,272 KB
testcase_45 AC 70 ms
71,320 KB
testcase_46 AC 80 ms
75,988 KB
testcase_47 AC 73 ms
71,060 KB
testcase_48 AC 87 ms
76,376 KB
testcase_49 AC 71 ms
71,308 KB
testcase_50 AC 88 ms
76,084 KB
testcase_51 AC 88 ms
76,536 KB
testcase_52 AC 93 ms
76,504 KB
testcase_53 AC 87 ms
75,948 KB
testcase_54 AC 93 ms
76,512 KB
testcase_55 AC 79 ms
75,300 KB
testcase_56 AC 68 ms
71,248 KB
testcase_57 AC 79 ms
75,160 KB
testcase_58 AC 75 ms
75,316 KB
testcase_59 AC 66 ms
71,324 KB
testcase_60 AC 70 ms
71,072 KB
testcase_61 AC 84 ms
75,244 KB
testcase_62 AC 69 ms
71,376 KB
testcase_63 AC 167 ms
84,204 KB
testcase_64 AC 124 ms
79,304 KB
testcase_65 AC 153 ms
83,092 KB
testcase_66 AC 147 ms
81,968 KB
testcase_67 AC 121 ms
78,960 KB
testcase_68 AC 146 ms
82,204 KB
testcase_69 AC 158 ms
83,000 KB
testcase_70 AC 140 ms
80,424 KB
testcase_71 AC 120 ms
78,608 KB
testcase_72 AC 151 ms
84,428 KB
testcase_73 AC 138 ms
79,964 KB
testcase_74 AC 149 ms
83,444 KB
testcase_75 AC 144 ms
81,388 KB
testcase_76 AC 101 ms
78,268 KB
testcase_77 AC 150 ms
82,460 KB
testcase_78 AC 179 ms
84,164 KB
testcase_79 AC 164 ms
84,112 KB
testcase_80 AC 161 ms
83,824 KB
testcase_81 AC 165 ms
84,356 KB
testcase_82 AC 156 ms
83,340 KB
testcase_83 AC 537 ms
130,532 KB
testcase_84 AC 531 ms
123,388 KB
testcase_85 AC 353 ms
105,664 KB
testcase_86 AC 462 ms
116,208 KB
testcase_87 AC 522 ms
119,884 KB
testcase_88 AC 183 ms
87,088 KB
testcase_89 AC 540 ms
129,560 KB
testcase_90 AC 380 ms
109,084 KB
testcase_91 AC 319 ms
102,096 KB
testcase_92 AC 219 ms
94,504 KB
testcase_93 AC 439 ms
115,268 KB
testcase_94 AC 403 ms
113,012 KB
testcase_95 AC 415 ms
113,072 KB
testcase_96 AC 503 ms
122,848 KB
testcase_97 AC 334 ms
98,060 KB
testcase_98 AC 527 ms
122,576 KB
testcase_99 AC 366 ms
104,592 KB
testcase_100 AC 591 ms
131,104 KB
testcase_101 AC 242 ms
93,140 KB
testcase_102 AC 181 ms
85,064 KB
testcase_103 AC 229 ms
93,440 KB
testcase_104 AC 291 ms
95,568 KB
testcase_105 AC 455 ms
115,464 KB
testcase_106 AC 305 ms
99,352 KB
testcase_107 AC 553 ms
129,472 KB
testcase_108 AC 546 ms
124,904 KB
testcase_109 AC 450 ms
114,980 KB
testcase_110 AC 434 ms
112,856 KB
testcase_111 AC 418 ms
113,080 KB
testcase_112 AC 263 ms
94,684 KB
testcase_113 AC 435 ms
112,604 KB
testcase_114 AC 311 ms
98,248 KB
testcase_115 AC 193 ms
87,308 KB
testcase_116 AC 342 ms
101,984 KB
testcase_117 AC 260 ms
94,840 KB
testcase_118 AC 530 ms
122,476 KB
testcase_119 AC 346 ms
104,044 KB
testcase_120 AC 485 ms
120,036 KB
testcase_121 AC 240 ms
94,208 KB
testcase_122 AC 326 ms
101,976 KB
testcase_123 AC 67 ms
71,524 KB
testcase_124 RE -
testcase_125 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
to = [[] for _ in range(n)]
bmap = {}
for i in range(1, n+1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
    bmap[(a, b)] = bmap[(b, a)] = i

num = [-1] * n
low = [-1] * n
visited = [False] * n
ans = 0
nm = 1
def dfs(v, p=-1):
    global nm
    visited[v] = True
    num[v] = nm
    nm += 1
    lw = num[v]
    for w in to[v]:
        if w == p:
            continue
        if not visited[w]:
            dfs(w, v)
            lw = min(lw, low[w])
        else:
            lw = min(lw, num[w])
    low[v] = lw
dfs(0)
ans = set(range(1, n+1))
visited = [False] * n
def dfs2(v, p=-1):
    visited[v] = True
    for w in to[v]:
        if w == p:
            continue
        if not visited[w]:
            dfs2(w, v)
            if low[w] > num[v]:
                if (v, w) in bmap:
                    tmp = bmap[(v, w)]
                    if tmp in ans:
                        ans.remove(tmp)
dfs2(0)
print(len(ans))
print(*ans)
0