結果
問題 | No.1254 補強への架け橋 |
ユーザー | convexineq |
提出日時 | 2020-12-21 22:18:21 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 276 ms / 2,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 82,816 KB |
実行使用メモリ | 104,192 KB |
最終ジャッジ日時 | 2024-09-21 13:10:33 |
合計ジャッジ時間 | 23,744 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,608 KB |
testcase_01 | AC | 39 ms
52,096 KB |
testcase_02 | AC | 38 ms
52,224 KB |
testcase_03 | AC | 39 ms
52,156 KB |
testcase_04 | AC | 38 ms
52,352 KB |
testcase_05 | AC | 39 ms
51,840 KB |
testcase_06 | AC | 39 ms
52,096 KB |
testcase_07 | AC | 38 ms
52,224 KB |
testcase_08 | AC | 38 ms
52,224 KB |
testcase_09 | AC | 41 ms
52,096 KB |
testcase_10 | AC | 41 ms
52,224 KB |
testcase_11 | AC | 40 ms
52,224 KB |
testcase_12 | AC | 38 ms
51,968 KB |
testcase_13 | AC | 40 ms
52,608 KB |
testcase_14 | AC | 40 ms
52,736 KB |
testcase_15 | AC | 39 ms
51,968 KB |
testcase_16 | AC | 42 ms
51,968 KB |
testcase_17 | AC | 38 ms
51,968 KB |
testcase_18 | AC | 42 ms
51,968 KB |
testcase_19 | AC | 39 ms
52,736 KB |
testcase_20 | AC | 41 ms
52,352 KB |
testcase_21 | AC | 39 ms
52,352 KB |
testcase_22 | AC | 39 ms
51,840 KB |
testcase_23 | AC | 39 ms
51,968 KB |
testcase_24 | AC | 39 ms
52,992 KB |
testcase_25 | AC | 40 ms
52,608 KB |
testcase_26 | AC | 40 ms
52,608 KB |
testcase_27 | AC | 40 ms
52,096 KB |
testcase_28 | AC | 40 ms
52,864 KB |
testcase_29 | AC | 40 ms
52,352 KB |
testcase_30 | AC | 39 ms
52,224 KB |
testcase_31 | AC | 39 ms
52,480 KB |
testcase_32 | AC | 38 ms
52,224 KB |
testcase_33 | AC | 40 ms
52,736 KB |
testcase_34 | AC | 40 ms
52,736 KB |
testcase_35 | AC | 41 ms
52,480 KB |
testcase_36 | AC | 38 ms
52,352 KB |
testcase_37 | AC | 39 ms
52,480 KB |
testcase_38 | AC | 39 ms
52,608 KB |
testcase_39 | AC | 38 ms
52,096 KB |
testcase_40 | AC | 40 ms
52,480 KB |
testcase_41 | AC | 39 ms
52,480 KB |
testcase_42 | AC | 39 ms
51,840 KB |
testcase_43 | AC | 57 ms
62,912 KB |
testcase_44 | AC | 45 ms
53,760 KB |
testcase_45 | AC | 43 ms
54,016 KB |
testcase_46 | AC | 56 ms
62,848 KB |
testcase_47 | AC | 48 ms
54,656 KB |
testcase_48 | AC | 53 ms
61,568 KB |
testcase_49 | AC | 41 ms
52,736 KB |
testcase_50 | AC | 59 ms
63,744 KB |
testcase_51 | AC | 58 ms
63,744 KB |
testcase_52 | AC | 59 ms
63,872 KB |
testcase_53 | AC | 55 ms
62,336 KB |
testcase_54 | AC | 57 ms
63,104 KB |
testcase_55 | AC | 56 ms
62,848 KB |
testcase_56 | AC | 42 ms
52,608 KB |
testcase_57 | AC | 53 ms
61,056 KB |
testcase_58 | AC | 53 ms
61,184 KB |
testcase_59 | AC | 41 ms
52,352 KB |
testcase_60 | AC | 44 ms
54,016 KB |
testcase_61 | AC | 56 ms
62,592 KB |
testcase_62 | AC | 42 ms
52,992 KB |
testcase_63 | AC | 97 ms
77,820 KB |
testcase_64 | AC | 87 ms
77,288 KB |
testcase_65 | AC | 93 ms
77,564 KB |
testcase_66 | AC | 92 ms
77,440 KB |
testcase_67 | AC | 80 ms
75,008 KB |
testcase_68 | AC | 92 ms
77,428 KB |
testcase_69 | AC | 93 ms
77,592 KB |
testcase_70 | AC | 89 ms
77,120 KB |
testcase_71 | AC | 86 ms
77,316 KB |
testcase_72 | AC | 94 ms
77,520 KB |
testcase_73 | AC | 88 ms
76,672 KB |
testcase_74 | AC | 94 ms
77,608 KB |
testcase_75 | AC | 93 ms
77,696 KB |
testcase_76 | AC | 73 ms
71,040 KB |
testcase_77 | AC | 93 ms
77,472 KB |
testcase_78 | AC | 96 ms
77,696 KB |
testcase_79 | AC | 98 ms
77,812 KB |
testcase_80 | AC | 97 ms
77,568 KB |
testcase_81 | AC | 96 ms
78,084 KB |
testcase_82 | AC | 96 ms
77,640 KB |
testcase_83 | AC | 272 ms
95,884 KB |
testcase_84 | AC | 268 ms
95,360 KB |
testcase_85 | AC | 194 ms
87,904 KB |
testcase_86 | AC | 231 ms
90,496 KB |
testcase_87 | AC | 253 ms
94,180 KB |
testcase_88 | AC | 104 ms
78,148 KB |
testcase_89 | AC | 264 ms
95,616 KB |
testcase_90 | AC | 190 ms
88,320 KB |
testcase_91 | AC | 158 ms
84,224 KB |
testcase_92 | AC | 118 ms
79,232 KB |
testcase_93 | AC | 215 ms
90,624 KB |
testcase_94 | AC | 200 ms
89,728 KB |
testcase_95 | AC | 200 ms
89,520 KB |
testcase_96 | AC | 259 ms
94,848 KB |
testcase_97 | AC | 153 ms
83,320 KB |
testcase_98 | AC | 272 ms
94,848 KB |
testcase_99 | AC | 193 ms
87,424 KB |
testcase_100 | AC | 276 ms
95,748 KB |
testcase_101 | AC | 116 ms
78,596 KB |
testcase_102 | AC | 102 ms
77,696 KB |
testcase_103 | AC | 118 ms
79,232 KB |
testcase_104 | AC | 143 ms
82,964 KB |
testcase_105 | AC | 221 ms
90,460 KB |
testcase_106 | AC | 152 ms
84,152 KB |
testcase_107 | AC | 266 ms
95,456 KB |
testcase_108 | AC | 268 ms
95,476 KB |
testcase_109 | AC | 213 ms
90,496 KB |
testcase_110 | AC | 199 ms
89,556 KB |
testcase_111 | AC | 211 ms
90,372 KB |
testcase_112 | AC | 136 ms
82,640 KB |
testcase_113 | AC | 201 ms
89,728 KB |
testcase_114 | AC | 154 ms
83,968 KB |
testcase_115 | AC | 106 ms
78,080 KB |
testcase_116 | AC | 166 ms
84,096 KB |
testcase_117 | AC | 135 ms
82,416 KB |
testcase_118 | AC | 255 ms
94,788 KB |
testcase_119 | AC | 170 ms
84,984 KB |
testcase_120 | AC | 254 ms
93,844 KB |
testcase_121 | AC | 127 ms
81,888 KB |
testcase_122 | AC | 157 ms
84,608 KB |
testcase_123 | AC | 39 ms
52,608 KB |
testcase_124 | AC | 263 ms
104,192 KB |
testcase_125 | AC | 260 ms
104,036 KB |
ソースコード
n = int(input()) g = [[] for _ in range(n)] deg = [0]*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)) deg[a] += 1 deg[b] += 1 used = [0]*n q = [g[i][0] for i in range(n) if deg[i]==1] while q: v,i = q.pop() if used[i]: continue used[i] = 1 deg[v] -= 1 if deg[v] == 1: q += g[v] ans = [i+1 for i in range(n) if used[i]==0] print(len(ans)) print(*ans)