結果
問題 | No.1254 補強への架け橋 |
ユーザー | rlangevin |
提出日時 | 2023-05-19 12:24:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 255 ms / 2,000 ms |
コード長 | 569 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 82,440 KB |
実行使用メモリ | 109,052 KB |
最終ジャッジ日時 | 2024-12-17 19:49:31 |
合計ジャッジ時間 | 21,873 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,420 KB |
testcase_01 | AC | 38 ms
53,144 KB |
testcase_02 | AC | 39 ms
52,856 KB |
testcase_03 | AC | 38 ms
52,736 KB |
testcase_04 | AC | 39 ms
52,320 KB |
testcase_05 | AC | 38 ms
53,448 KB |
testcase_06 | AC | 37 ms
53,440 KB |
testcase_07 | AC | 38 ms
52,804 KB |
testcase_08 | AC | 37 ms
52,460 KB |
testcase_09 | AC | 39 ms
52,364 KB |
testcase_10 | AC | 38 ms
52,196 KB |
testcase_11 | AC | 37 ms
52,948 KB |
testcase_12 | AC | 38 ms
52,500 KB |
testcase_13 | AC | 38 ms
54,124 KB |
testcase_14 | AC | 38 ms
52,496 KB |
testcase_15 | AC | 39 ms
52,136 KB |
testcase_16 | AC | 38 ms
53,140 KB |
testcase_17 | AC | 37 ms
53,020 KB |
testcase_18 | AC | 39 ms
52,692 KB |
testcase_19 | AC | 38 ms
52,620 KB |
testcase_20 | AC | 39 ms
53,196 KB |
testcase_21 | AC | 39 ms
54,140 KB |
testcase_22 | AC | 39 ms
53,376 KB |
testcase_23 | AC | 37 ms
52,588 KB |
testcase_24 | AC | 39 ms
52,572 KB |
testcase_25 | AC | 36 ms
52,964 KB |
testcase_26 | AC | 38 ms
52,708 KB |
testcase_27 | AC | 38 ms
53,812 KB |
testcase_28 | AC | 38 ms
52,760 KB |
testcase_29 | AC | 37 ms
53,088 KB |
testcase_30 | AC | 37 ms
53,684 KB |
testcase_31 | AC | 37 ms
52,568 KB |
testcase_32 | AC | 38 ms
52,276 KB |
testcase_33 | AC | 38 ms
52,684 KB |
testcase_34 | AC | 38 ms
54,280 KB |
testcase_35 | AC | 38 ms
53,564 KB |
testcase_36 | AC | 39 ms
52,712 KB |
testcase_37 | AC | 39 ms
52,612 KB |
testcase_38 | AC | 39 ms
53,336 KB |
testcase_39 | AC | 39 ms
52,460 KB |
testcase_40 | AC | 39 ms
54,172 KB |
testcase_41 | AC | 41 ms
52,436 KB |
testcase_42 | AC | 41 ms
52,672 KB |
testcase_43 | AC | 49 ms
62,564 KB |
testcase_44 | AC | 39 ms
54,192 KB |
testcase_45 | AC | 41 ms
53,572 KB |
testcase_46 | AC | 48 ms
61,500 KB |
testcase_47 | AC | 39 ms
55,372 KB |
testcase_48 | AC | 46 ms
60,988 KB |
testcase_49 | AC | 39 ms
52,824 KB |
testcase_50 | AC | 47 ms
60,860 KB |
testcase_51 | AC | 47 ms
60,848 KB |
testcase_52 | AC | 46 ms
61,348 KB |
testcase_53 | AC | 46 ms
60,948 KB |
testcase_54 | AC | 48 ms
62,216 KB |
testcase_55 | AC | 49 ms
62,164 KB |
testcase_56 | AC | 40 ms
53,228 KB |
testcase_57 | AC | 47 ms
60,964 KB |
testcase_58 | AC | 45 ms
60,496 KB |
testcase_59 | AC | 39 ms
52,888 KB |
testcase_60 | AC | 40 ms
53,688 KB |
testcase_61 | AC | 46 ms
60,724 KB |
testcase_62 | AC | 38 ms
53,492 KB |
testcase_63 | AC | 81 ms
78,644 KB |
testcase_64 | AC | 66 ms
70,652 KB |
testcase_65 | AC | 70 ms
74,196 KB |
testcase_66 | AC | 69 ms
73,408 KB |
testcase_67 | AC | 65 ms
68,948 KB |
testcase_68 | AC | 73 ms
75,184 KB |
testcase_69 | AC | 80 ms
77,740 KB |
testcase_70 | AC | 67 ms
72,408 KB |
testcase_71 | AC | 67 ms
70,128 KB |
testcase_72 | AC | 80 ms
77,420 KB |
testcase_73 | AC | 66 ms
71,308 KB |
testcase_74 | AC | 81 ms
77,388 KB |
testcase_75 | AC | 71 ms
74,664 KB |
testcase_76 | AC | 57 ms
65,364 KB |
testcase_77 | AC | 73 ms
74,288 KB |
testcase_78 | AC | 89 ms
77,892 KB |
testcase_79 | AC | 80 ms
77,836 KB |
testcase_80 | AC | 80 ms
77,544 KB |
testcase_81 | AC | 83 ms
78,476 KB |
testcase_82 | AC | 81 ms
78,472 KB |
testcase_83 | AC | 252 ms
108,892 KB |
testcase_84 | AC | 252 ms
107,064 KB |
testcase_85 | AC | 162 ms
95,792 KB |
testcase_86 | AC | 211 ms
102,776 KB |
testcase_87 | AC | 241 ms
104,212 KB |
testcase_88 | AC | 90 ms
79,748 KB |
testcase_89 | AC | 254 ms
107,092 KB |
testcase_90 | AC | 170 ms
96,488 KB |
testcase_91 | AC | 152 ms
92,136 KB |
testcase_92 | AC | 103 ms
82,528 KB |
testcase_93 | AC | 196 ms
100,128 KB |
testcase_94 | AC | 179 ms
98,208 KB |
testcase_95 | AC | 180 ms
98,168 KB |
testcase_96 | AC | 241 ms
104,748 KB |
testcase_97 | AC | 126 ms
86,388 KB |
testcase_98 | AC | 243 ms
105,280 KB |
testcase_99 | AC | 159 ms
94,628 KB |
testcase_100 | AC | 255 ms
108,956 KB |
testcase_101 | AC | 99 ms
81,968 KB |
testcase_102 | AC | 84 ms
79,088 KB |
testcase_103 | AC | 101 ms
82,492 KB |
testcase_104 | AC | 119 ms
84,224 KB |
testcase_105 | AC | 195 ms
100,064 KB |
testcase_106 | AC | 142 ms
89,064 KB |
testcase_107 | AC | 242 ms
109,052 KB |
testcase_108 | AC | 246 ms
108,904 KB |
testcase_109 | AC | 200 ms
100,504 KB |
testcase_110 | AC | 189 ms
98,088 KB |
testcase_111 | AC | 193 ms
98,696 KB |
testcase_112 | AC | 110 ms
84,116 KB |
testcase_113 | AC | 172 ms
97,756 KB |
testcase_114 | AC | 126 ms
86,456 KB |
testcase_115 | AC | 90 ms
80,540 KB |
testcase_116 | AC | 154 ms
91,960 KB |
testcase_117 | AC | 112 ms
84,572 KB |
testcase_118 | AC | 232 ms
104,640 KB |
testcase_119 | AC | 164 ms
94,620 KB |
testcase_120 | AC | 231 ms
104,008 KB |
testcase_121 | AC | 107 ms
82,780 KB |
testcase_122 | AC | 145 ms
91,432 KB |
testcase_123 | AC | 37 ms
53,136 KB |
testcase_124 | AC | 200 ms
103,120 KB |
testcase_125 | AC | 208 ms
102,972 KB |
ソースコード
import sys input = sys.stdin.readline N = int(input()) G = [[] for i in range(N)] deg = [0] * N for i in range(N): a, b = map(int, input().split()) a, b = a - 1, b - 1 G[a].append((b, i)) G[b].append((a, i)) deg[a] += 1 deg[b] += 1 Q = [] S = set() for i in range(N): if deg[i] == 1: Q.append(i) while Q: u = Q.pop() for v, i in G[u]: deg[v] -= 1 if deg[v] == 1: Q.append(v) S.add(i) ans = [] for i in range(N): if i not in S: ans.append(i + 1) print(len(ans)) print(*ans)