結果
問題 | No.1254 補強への架け橋 |
ユーザー | Kude |
提出日時 | 2020-10-09 22:50:37 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 895 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 129,272 KB |
最終ジャッジ日時 | 2024-07-20 13:19:22 |
合計ジャッジ時間 | 26,245 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
51,712 KB |
testcase_01 | AC | 39 ms
51,712 KB |
testcase_02 | AC | 40 ms
52,224 KB |
testcase_03 | AC | 38 ms
52,224 KB |
testcase_04 | AC | 36 ms
52,096 KB |
testcase_05 | AC | 36 ms
52,224 KB |
testcase_06 | AC | 35 ms
52,224 KB |
testcase_07 | AC | 35 ms
52,592 KB |
testcase_08 | AC | 34 ms
52,224 KB |
testcase_09 | AC | 36 ms
52,352 KB |
testcase_10 | AC | 35 ms
51,968 KB |
testcase_11 | AC | 34 ms
52,480 KB |
testcase_12 | AC | 35 ms
51,712 KB |
testcase_13 | AC | 35 ms
52,480 KB |
testcase_14 | AC | 37 ms
52,480 KB |
testcase_15 | AC | 40 ms
51,968 KB |
testcase_16 | AC | 36 ms
52,352 KB |
testcase_17 | AC | 35 ms
52,480 KB |
testcase_18 | AC | 36 ms
52,352 KB |
testcase_19 | AC | 34 ms
52,352 KB |
testcase_20 | AC | 37 ms
52,096 KB |
testcase_21 | AC | 37 ms
52,352 KB |
testcase_22 | AC | 36 ms
51,840 KB |
testcase_23 | AC | 37 ms
52,480 KB |
testcase_24 | AC | 37 ms
52,736 KB |
testcase_25 | AC | 36 ms
52,224 KB |
testcase_26 | AC | 37 ms
52,352 KB |
testcase_27 | AC | 36 ms
52,352 KB |
testcase_28 | AC | 37 ms
52,480 KB |
testcase_29 | AC | 35 ms
52,224 KB |
testcase_30 | AC | 36 ms
52,352 KB |
testcase_31 | AC | 36 ms
52,608 KB |
testcase_32 | AC | 36 ms
52,096 KB |
testcase_33 | AC | 37 ms
52,736 KB |
testcase_34 | AC | 38 ms
53,028 KB |
testcase_35 | AC | 40 ms
52,736 KB |
testcase_36 | AC | 37 ms
52,736 KB |
testcase_37 | AC | 37 ms
52,352 KB |
testcase_38 | AC | 36 ms
52,352 KB |
testcase_39 | AC | 38 ms
52,352 KB |
testcase_40 | AC | 36 ms
52,096 KB |
testcase_41 | AC | 36 ms
52,864 KB |
testcase_42 | AC | 37 ms
52,352 KB |
testcase_43 | AC | 57 ms
64,640 KB |
testcase_44 | AC | 41 ms
54,272 KB |
testcase_45 | AC | 41 ms
53,760 KB |
testcase_46 | AC | 57 ms
64,768 KB |
testcase_47 | AC | 43 ms
55,040 KB |
testcase_48 | AC | 61 ms
66,944 KB |
testcase_49 | AC | 37 ms
52,608 KB |
testcase_50 | AC | 59 ms
66,560 KB |
testcase_51 | AC | 64 ms
67,328 KB |
testcase_52 | AC | 68 ms
70,528 KB |
testcase_53 | AC | 57 ms
65,280 KB |
testcase_54 | AC | 67 ms
69,632 KB |
testcase_55 | AC | 54 ms
63,488 KB |
testcase_56 | AC | 38 ms
53,120 KB |
testcase_57 | AC | 50 ms
62,208 KB |
testcase_58 | AC | 51 ms
61,440 KB |
testcase_59 | AC | 39 ms
52,992 KB |
testcase_60 | AC | 41 ms
53,760 KB |
testcase_61 | AC | 54 ms
63,616 KB |
testcase_62 | AC | 37 ms
52,992 KB |
testcase_63 | AC | 133 ms
83,200 KB |
testcase_64 | AC | 103 ms
78,208 KB |
testcase_65 | AC | 125 ms
80,956 KB |
testcase_66 | AC | 122 ms
79,744 KB |
testcase_67 | AC | 97 ms
77,428 KB |
testcase_68 | AC | 119 ms
80,384 KB |
testcase_69 | AC | 133 ms
81,564 KB |
testcase_70 | AC | 112 ms
78,296 KB |
testcase_71 | AC | 96 ms
77,232 KB |
testcase_72 | AC | 123 ms
81,664 KB |
testcase_73 | AC | 108 ms
78,336 KB |
testcase_74 | AC | 125 ms
81,104 KB |
testcase_75 | AC | 120 ms
79,744 KB |
testcase_76 | AC | 78 ms
75,480 KB |
testcase_77 | AC | 122 ms
79,872 KB |
testcase_78 | AC | 147 ms
82,312 KB |
testcase_79 | AC | 133 ms
82,388 KB |
testcase_80 | AC | 130 ms
81,664 KB |
testcase_81 | AC | 133 ms
82,604 KB |
testcase_82 | AC | 125 ms
81,824 KB |
testcase_83 | AC | 463 ms
128,032 KB |
testcase_84 | AC | 442 ms
121,516 KB |
testcase_85 | AC | 297 ms
104,148 KB |
testcase_86 | AC | 408 ms
115,280 KB |
testcase_87 | AC | 444 ms
118,388 KB |
testcase_88 | AC | 147 ms
84,776 KB |
testcase_89 | AC | 464 ms
128,176 KB |
testcase_90 | AC | 320 ms
104,608 KB |
testcase_91 | AC | 280 ms
99,412 KB |
testcase_92 | AC | 190 ms
93,388 KB |
testcase_93 | AC | 402 ms
113,808 KB |
testcase_94 | AC | 380 ms
111,228 KB |
testcase_95 | AC | 366 ms
111,172 KB |
testcase_96 | AC | 473 ms
121,124 KB |
testcase_97 | AC | 245 ms
96,040 KB |
testcase_98 | AC | 467 ms
121,040 KB |
testcase_99 | AC | 296 ms
102,328 KB |
testcase_100 | AC | 486 ms
129,272 KB |
testcase_101 | AC | 191 ms
91,264 KB |
testcase_102 | AC | 148 ms
83,348 KB |
testcase_103 | AC | 189 ms
92,004 KB |
testcase_104 | AC | 250 ms
95,260 KB |
testcase_105 | AC | 383 ms
113,736 KB |
testcase_106 | AC | 246 ms
97,828 KB |
testcase_107 | AC | 462 ms
127,960 KB |
testcase_108 | AC | 461 ms
122,840 KB |
testcase_109 | AC | 382 ms
113,524 KB |
testcase_110 | AC | 350 ms
110,440 KB |
testcase_111 | AC | 358 ms
111,492 KB |
testcase_112 | AC | 221 ms
94,960 KB |
testcase_113 | AC | 370 ms
111,396 KB |
testcase_114 | AC | 263 ms
96,896 KB |
testcase_115 | AC | 178 ms
85,120 KB |
testcase_116 | AC | 282 ms
100,268 KB |
testcase_117 | AC | 239 ms
95,016 KB |
testcase_118 | AC | 462 ms
120,832 KB |
testcase_119 | AC | 289 ms
102,724 KB |
testcase_120 | AC | 425 ms
117,548 KB |
testcase_121 | AC | 203 ms
93,568 KB |
testcase_122 | AC | 269 ms
99,768 KB |
testcase_123 | AC | 36 ms
52,224 KB |
testcase_124 | RE | - |
testcase_125 | RE | - |
ソースコード
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) if low[w] > num[v]: ans.remove(bmap[(v, w)]) dfs2(0) print(len(ans)) print(*ans)