結果
問題 | No.1254 補強への架け橋 |
ユーザー | ayaoni |
提出日時 | 2020-10-29 23:39:32 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 831 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 82,360 KB |
実行使用メモリ | 118,896 KB |
最終ジャッジ日時 | 2024-07-21 22:46:29 |
合計ジャッジ時間 | 19,918 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
51,968 KB |
testcase_01 | AC | 35 ms
52,224 KB |
testcase_02 | AC | 34 ms
52,096 KB |
testcase_03 | AC | 34 ms
52,096 KB |
testcase_04 | AC | 34 ms
52,096 KB |
testcase_05 | AC | 35 ms
52,480 KB |
testcase_06 | AC | 34 ms
51,712 KB |
testcase_07 | AC | 33 ms
52,068 KB |
testcase_08 | AC | 36 ms
51,968 KB |
testcase_09 | AC | 37 ms
51,584 KB |
testcase_10 | AC | 37 ms
52,480 KB |
testcase_11 | AC | 34 ms
51,936 KB |
testcase_12 | AC | 34 ms
51,712 KB |
testcase_13 | AC | 35 ms
52,352 KB |
testcase_14 | AC | 36 ms
52,480 KB |
testcase_15 | AC | 35 ms
51,968 KB |
testcase_16 | AC | 36 ms
51,968 KB |
testcase_17 | AC | 35 ms
51,712 KB |
testcase_18 | AC | 34 ms
51,968 KB |
testcase_19 | AC | 35 ms
51,968 KB |
testcase_20 | AC | 34 ms
52,352 KB |
testcase_21 | AC | 34 ms
51,840 KB |
testcase_22 | AC | 33 ms
51,968 KB |
testcase_23 | AC | 35 ms
52,224 KB |
testcase_24 | AC | 34 ms
52,352 KB |
testcase_25 | AC | 34 ms
52,480 KB |
testcase_26 | AC | 35 ms
52,224 KB |
testcase_27 | AC | 35 ms
52,224 KB |
testcase_28 | AC | 35 ms
52,480 KB |
testcase_29 | AC | 48 ms
52,224 KB |
testcase_30 | AC | 34 ms
52,480 KB |
testcase_31 | AC | 33 ms
52,352 KB |
testcase_32 | AC | 33 ms
52,096 KB |
testcase_33 | AC | 35 ms
51,968 KB |
testcase_34 | AC | 37 ms
52,736 KB |
testcase_35 | AC | 37 ms
52,328 KB |
testcase_36 | AC | 36 ms
52,608 KB |
testcase_37 | AC | 34 ms
52,224 KB |
testcase_38 | AC | 36 ms
52,096 KB |
testcase_39 | AC | 35 ms
52,352 KB |
testcase_40 | AC | 35 ms
51,968 KB |
testcase_41 | AC | 35 ms
52,224 KB |
testcase_42 | AC | 36 ms
51,712 KB |
testcase_43 | AC | 39 ms
54,784 KB |
testcase_44 | AC | 36 ms
53,504 KB |
testcase_45 | AC | 36 ms
52,480 KB |
testcase_46 | AC | 37 ms
54,272 KB |
testcase_47 | AC | 38 ms
53,504 KB |
testcase_48 | AC | 38 ms
53,888 KB |
testcase_49 | AC | 36 ms
52,480 KB |
testcase_50 | AC | 44 ms
60,416 KB |
testcase_51 | AC | 39 ms
54,400 KB |
testcase_52 | AC | 42 ms
59,776 KB |
testcase_53 | AC | 40 ms
54,272 KB |
testcase_54 | AC | 38 ms
54,400 KB |
testcase_55 | AC | 41 ms
59,392 KB |
testcase_56 | AC | 35 ms
52,352 KB |
testcase_57 | AC | 37 ms
53,632 KB |
testcase_58 | AC | 37 ms
53,888 KB |
testcase_59 | AC | 33 ms
52,096 KB |
testcase_60 | AC | 46 ms
52,608 KB |
testcase_61 | AC | 37 ms
53,888 KB |
testcase_62 | AC | 34 ms
52,096 KB |
testcase_63 | AC | 79 ms
81,488 KB |
testcase_64 | AC | 57 ms
70,400 KB |
testcase_65 | AC | 77 ms
79,744 KB |
testcase_66 | AC | 81 ms
78,864 KB |
testcase_67 | AC | 56 ms
69,248 KB |
testcase_68 | AC | 71 ms
79,268 KB |
testcase_69 | AC | 76 ms
80,512 KB |
testcase_70 | AC | 59 ms
71,296 KB |
testcase_71 | AC | 56 ms
70,528 KB |
testcase_72 | AC | 73 ms
80,052 KB |
testcase_73 | AC | 56 ms
70,016 KB |
testcase_74 | AC | 78 ms
80,384 KB |
testcase_75 | AC | 74 ms
78,592 KB |
testcase_76 | AC | 48 ms
64,000 KB |
testcase_77 | AC | 78 ms
78,592 KB |
testcase_78 | AC | 90 ms
81,280 KB |
testcase_79 | AC | 79 ms
80,896 KB |
testcase_80 | AC | 79 ms
80,768 KB |
testcase_81 | AC | 76 ms
81,280 KB |
testcase_82 | AC | 79 ms
80,716 KB |
testcase_83 | AC | 268 ms
114,844 KB |
testcase_84 | AC | 247 ms
111,420 KB |
testcase_85 | AC | 147 ms
101,796 KB |
testcase_86 | AC | 225 ms
112,024 KB |
testcase_87 | AC | 231 ms
111,224 KB |
testcase_88 | AC | 93 ms
81,920 KB |
testcase_89 | AC | 254 ms
114,772 KB |
testcase_90 | AC | 176 ms
101,896 KB |
testcase_91 | AC | 152 ms
101,312 KB |
testcase_92 | AC | 106 ms
90,736 KB |
testcase_93 | AC | 192 ms
111,768 KB |
testcase_94 | AC | 189 ms
106,628 KB |
testcase_95 | AC | 203 ms
106,756 KB |
testcase_96 | AC | 249 ms
111,560 KB |
testcase_97 | AC | 136 ms
101,368 KB |
testcase_98 | AC | 235 ms
111,292 KB |
testcase_99 | AC | 168 ms
101,584 KB |
testcase_100 | AC | 230 ms
113,196 KB |
testcase_101 | AC | 102 ms
88,448 KB |
testcase_102 | AC | 92 ms
81,920 KB |
testcase_103 | AC | 102 ms
88,600 KB |
testcase_104 | AC | 129 ms
95,804 KB |
testcase_105 | AC | 197 ms
111,056 KB |
testcase_106 | AC | 137 ms
101,660 KB |
testcase_107 | AC | 263 ms
114,812 KB |
testcase_108 | AC | 239 ms
111,544 KB |
testcase_109 | AC | 218 ms
111,140 KB |
testcase_110 | AC | 173 ms
105,812 KB |
testcase_111 | AC | 213 ms
107,052 KB |
testcase_112 | AC | 124 ms
95,152 KB |
testcase_113 | AC | 194 ms
105,664 KB |
testcase_114 | AC | 147 ms
101,476 KB |
testcase_115 | AC | 87 ms
81,940 KB |
testcase_116 | AC | 165 ms
101,464 KB |
testcase_117 | AC | 129 ms
95,476 KB |
testcase_118 | AC | 216 ms
111,660 KB |
testcase_119 | AC | 171 ms
101,888 KB |
testcase_120 | AC | 213 ms
111,520 KB |
testcase_121 | AC | 112 ms
91,492 KB |
testcase_122 | AC | 137 ms
101,544 KB |
testcase_123 | AC | 35 ms
51,968 KB |
testcase_124 | RE | - |
testcase_125 | RE | - |
ソースコード
import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) N = I() Graph = [[] for _ in range(N+1)] dict_edge = {} for i in range(1,N+1): a,b = MI() Graph[a].append(b) Graph[b].append(a) dict_edge[(a,b)] = i dict_edge[(b,a)] = i flag = [0]*(N+1) previous = [0]*(N+1) ANS = [] def dfs(i,par): flag[i] = 1 for j in Graph[i]: if j == par: continue elif flag[j] == 0: flag[j] = 1 previous[j] = i dfs(j,i) else: ANS.append(dict_edge[(i,j)]) k = i while k != j: ANS.append(dict_edge[k,previous[k]]) k = previous[k] print(len(ANS)) print(*ANS) exit() dfs(1,0)