結果
問題 | No.1254 補強への架け橋 |
ユーザー | tktk_snsn |
提出日時 | 2021-04-24 12:06:34 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 661 ms / 2,000 ms |
コード長 | 778 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 68,736 KB |
最終ジャッジ日時 | 2024-07-04 09:03:52 |
合計ジャッジ時間 | 24,902 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
10,496 KB |
testcase_01 | AC | 27 ms
10,752 KB |
testcase_02 | AC | 28 ms
10,496 KB |
testcase_03 | AC | 28 ms
10,624 KB |
testcase_04 | AC | 28 ms
10,752 KB |
testcase_05 | AC | 28 ms
10,624 KB |
testcase_06 | AC | 27 ms
10,624 KB |
testcase_07 | AC | 28 ms
10,752 KB |
testcase_08 | AC | 26 ms
10,496 KB |
testcase_09 | AC | 27 ms
10,496 KB |
testcase_10 | AC | 27 ms
10,624 KB |
testcase_11 | AC | 28 ms
10,752 KB |
testcase_12 | AC | 28 ms
10,752 KB |
testcase_13 | AC | 28 ms
10,624 KB |
testcase_14 | AC | 27 ms
10,624 KB |
testcase_15 | AC | 28 ms
10,496 KB |
testcase_16 | AC | 28 ms
10,624 KB |
testcase_17 | AC | 28 ms
10,624 KB |
testcase_18 | AC | 27 ms
10,752 KB |
testcase_19 | AC | 26 ms
10,624 KB |
testcase_20 | AC | 28 ms
10,624 KB |
testcase_21 | AC | 27 ms
10,496 KB |
testcase_22 | AC | 26 ms
10,624 KB |
testcase_23 | AC | 26 ms
10,624 KB |
testcase_24 | AC | 26 ms
10,624 KB |
testcase_25 | AC | 28 ms
10,624 KB |
testcase_26 | AC | 27 ms
10,752 KB |
testcase_27 | AC | 25 ms
10,624 KB |
testcase_28 | AC | 28 ms
10,624 KB |
testcase_29 | AC | 27 ms
10,496 KB |
testcase_30 | AC | 26 ms
10,496 KB |
testcase_31 | AC | 28 ms
10,752 KB |
testcase_32 | AC | 25 ms
10,624 KB |
testcase_33 | AC | 29 ms
10,624 KB |
testcase_34 | AC | 29 ms
10,624 KB |
testcase_35 | AC | 28 ms
10,624 KB |
testcase_36 | AC | 26 ms
10,624 KB |
testcase_37 | AC | 27 ms
10,496 KB |
testcase_38 | AC | 27 ms
10,624 KB |
testcase_39 | AC | 27 ms
10,624 KB |
testcase_40 | AC | 26 ms
10,496 KB |
testcase_41 | AC | 25 ms
10,496 KB |
testcase_42 | AC | 25 ms
10,496 KB |
testcase_43 | AC | 29 ms
11,008 KB |
testcase_44 | AC | 29 ms
10,752 KB |
testcase_45 | AC | 29 ms
10,624 KB |
testcase_46 | AC | 28 ms
10,880 KB |
testcase_47 | AC | 28 ms
10,624 KB |
testcase_48 | AC | 29 ms
10,880 KB |
testcase_49 | AC | 27 ms
10,496 KB |
testcase_50 | AC | 29 ms
10,880 KB |
testcase_51 | AC | 30 ms
10,880 KB |
testcase_52 | AC | 30 ms
11,008 KB |
testcase_53 | AC | 31 ms
10,880 KB |
testcase_54 | AC | 30 ms
11,008 KB |
testcase_55 | AC | 29 ms
11,008 KB |
testcase_56 | AC | 28 ms
10,624 KB |
testcase_57 | AC | 30 ms
10,752 KB |
testcase_58 | AC | 30 ms
10,752 KB |
testcase_59 | AC | 28 ms
10,752 KB |
testcase_60 | AC | 29 ms
10,752 KB |
testcase_61 | AC | 31 ms
11,008 KB |
testcase_62 | AC | 29 ms
10,496 KB |
testcase_63 | AC | 60 ms
14,464 KB |
testcase_64 | AC | 36 ms
11,776 KB |
testcase_65 | AC | 51 ms
13,056 KB |
testcase_66 | AC | 42 ms
12,416 KB |
testcase_67 | AC | 33 ms
11,392 KB |
testcase_68 | AC | 44 ms
12,672 KB |
testcase_69 | AC | 52 ms
13,312 KB |
testcase_70 | AC | 36 ms
11,776 KB |
testcase_71 | AC | 33 ms
11,520 KB |
testcase_72 | AC | 50 ms
13,312 KB |
testcase_73 | AC | 36 ms
11,776 KB |
testcase_74 | AC | 52 ms
13,184 KB |
testcase_75 | AC | 44 ms
12,544 KB |
testcase_76 | AC | 31 ms
11,008 KB |
testcase_77 | AC | 40 ms
12,288 KB |
testcase_78 | AC | 54 ms
13,952 KB |
testcase_79 | AC | 58 ms
14,080 KB |
testcase_80 | AC | 51 ms
13,696 KB |
testcase_81 | AC | 57 ms
13,952 KB |
testcase_82 | AC | 56 ms
13,824 KB |
testcase_83 | AC | 479 ms
46,848 KB |
testcase_84 | AC | 463 ms
46,080 KB |
testcase_85 | AC | 271 ms
32,896 KB |
testcase_86 | AC | 372 ms
41,088 KB |
testcase_87 | AC | 438 ms
43,904 KB |
testcase_88 | AC | 74 ms
16,128 KB |
testcase_89 | AC | 457 ms
46,720 KB |
testcase_90 | AC | 296 ms
34,048 KB |
testcase_91 | AC | 233 ms
29,184 KB |
testcase_92 | AC | 117 ms
20,736 KB |
testcase_93 | AC | 375 ms
39,680 KB |
testcase_94 | AC | 331 ms
36,992 KB |
testcase_95 | AC | 332 ms
36,864 KB |
testcase_96 | AC | 449 ms
45,056 KB |
testcase_97 | AC | 205 ms
26,496 KB |
testcase_98 | AC | 436 ms
45,184 KB |
testcase_99 | AC | 259 ms
32,128 KB |
testcase_100 | AC | 482 ms
47,744 KB |
testcase_101 | AC | 105 ms
19,712 KB |
testcase_102 | AC | 64 ms
15,232 KB |
testcase_103 | AC | 114 ms
20,480 KB |
testcase_104 | AC | 159 ms
24,064 KB |
testcase_105 | AC | 357 ms
39,680 KB |
testcase_106 | AC | 210 ms
27,904 KB |
testcase_107 | AC | 450 ms
46,592 KB |
testcase_108 | AC | 466 ms
46,336 KB |
testcase_109 | AC | 369 ms
39,424 KB |
testcase_110 | AC | 316 ms
36,736 KB |
testcase_111 | AC | 368 ms
38,400 KB |
testcase_112 | AC | 147 ms
23,296 KB |
testcase_113 | AC | 302 ms
35,968 KB |
testcase_114 | AC | 207 ms
27,392 KB |
testcase_115 | AC | 80 ms
16,640 KB |
testcase_116 | AC | 233 ms
29,952 KB |
testcase_117 | AC | 155 ms
23,552 KB |
testcase_118 | AC | 428 ms
44,544 KB |
testcase_119 | AC | 268 ms
31,616 KB |
testcase_120 | AC | 418 ms
43,520 KB |
testcase_121 | AC | 129 ms
21,504 KB |
testcase_122 | AC | 245 ms
29,440 KB |
testcase_123 | AC | 27 ms
10,624 KB |
testcase_124 | AC | 661 ms
68,736 KB |
testcase_125 | AC | 655 ms
68,608 KB |
ソースコード
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N = int(input()) G = [[] for _ in range(N)] for i in range(N): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append((b, i)) G[b].append((a, i)) bridge = [0] * N vis = [0] * N entry = [-1] * N low = [-1] * N time = 0 def dfs(s, p=-1): global time vis[s] = 1 entry[s] = time low[s] = time time += 1 for t, i in G[s]: if t == p: continue if vis[t]: low[s] = min(low[s], entry[t]) else: dfs(t, s) low[s] = min(low[s], low[t]) if entry[s] < low[t]: bridge[i] = 1 dfs(0) ans = [i for i, b in enumerate(bridge, 1) if b == 0] print(len(ans)) print(*ans)