結果
問題 | No.1254 補強への架け橋 |
ユーザー | proribone |
提出日時 | 2020-10-10 14:58:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 505 ms / 2,000 ms |
コード長 | 859 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 202,496 KB |
最終ジャッジ日時 | 2024-07-20 15:59:33 |
合計ジャッジ時間 | 23,153 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
52,096 KB |
testcase_01 | AC | 40 ms
51,968 KB |
testcase_02 | AC | 40 ms
51,840 KB |
testcase_03 | AC | 40 ms
52,096 KB |
testcase_04 | AC | 40 ms
51,840 KB |
testcase_05 | AC | 40 ms
52,224 KB |
testcase_06 | AC | 40 ms
51,840 KB |
testcase_07 | AC | 41 ms
52,224 KB |
testcase_08 | AC | 41 ms
52,096 KB |
testcase_09 | AC | 41 ms
51,968 KB |
testcase_10 | AC | 41 ms
51,968 KB |
testcase_11 | AC | 40 ms
52,224 KB |
testcase_12 | AC | 40 ms
51,840 KB |
testcase_13 | AC | 41 ms
52,736 KB |
testcase_14 | AC | 42 ms
52,352 KB |
testcase_15 | AC | 40 ms
52,480 KB |
testcase_16 | AC | 41 ms
51,968 KB |
testcase_17 | AC | 40 ms
51,840 KB |
testcase_18 | AC | 41 ms
51,840 KB |
testcase_19 | AC | 40 ms
52,224 KB |
testcase_20 | AC | 42 ms
52,352 KB |
testcase_21 | AC | 40 ms
52,608 KB |
testcase_22 | AC | 42 ms
52,096 KB |
testcase_23 | AC | 42 ms
52,096 KB |
testcase_24 | AC | 41 ms
52,736 KB |
testcase_25 | AC | 41 ms
52,224 KB |
testcase_26 | AC | 43 ms
52,480 KB |
testcase_27 | AC | 44 ms
52,480 KB |
testcase_28 | AC | 42 ms
52,608 KB |
testcase_29 | AC | 41 ms
52,096 KB |
testcase_30 | AC | 41 ms
52,224 KB |
testcase_31 | AC | 42 ms
52,608 KB |
testcase_32 | AC | 41 ms
52,096 KB |
testcase_33 | AC | 42 ms
52,736 KB |
testcase_34 | AC | 42 ms
52,608 KB |
testcase_35 | AC | 42 ms
52,608 KB |
testcase_36 | AC | 42 ms
52,736 KB |
testcase_37 | AC | 42 ms
52,224 KB |
testcase_38 | AC | 43 ms
52,224 KB |
testcase_39 | AC | 41 ms
52,096 KB |
testcase_40 | AC | 41 ms
52,352 KB |
testcase_41 | AC | 41 ms
52,096 KB |
testcase_42 | AC | 41 ms
52,224 KB |
testcase_43 | AC | 59 ms
61,568 KB |
testcase_44 | AC | 47 ms
54,400 KB |
testcase_45 | AC | 45 ms
53,888 KB |
testcase_46 | AC | 54 ms
56,192 KB |
testcase_47 | AC | 48 ms
54,656 KB |
testcase_48 | AC | 52 ms
55,808 KB |
testcase_49 | AC | 43 ms
52,608 KB |
testcase_50 | AC | 61 ms
63,872 KB |
testcase_51 | AC | 59 ms
62,848 KB |
testcase_52 | AC | 62 ms
64,000 KB |
testcase_53 | AC | 55 ms
56,448 KB |
testcase_54 | AC | 61 ms
62,208 KB |
testcase_55 | AC | 64 ms
61,568 KB |
testcase_56 | AC | 40 ms
52,992 KB |
testcase_57 | AC | 46 ms
55,296 KB |
testcase_58 | AC | 47 ms
55,552 KB |
testcase_59 | AC | 39 ms
52,480 KB |
testcase_60 | AC | 42 ms
54,400 KB |
testcase_61 | AC | 51 ms
61,568 KB |
testcase_62 | AC | 40 ms
53,120 KB |
testcase_63 | AC | 103 ms
77,540 KB |
testcase_64 | AC | 89 ms
76,800 KB |
testcase_65 | AC | 100 ms
77,312 KB |
testcase_66 | AC | 104 ms
77,436 KB |
testcase_67 | AC | 85 ms
77,056 KB |
testcase_68 | AC | 93 ms
76,972 KB |
testcase_69 | AC | 104 ms
77,440 KB |
testcase_70 | AC | 86 ms
76,840 KB |
testcase_71 | AC | 85 ms
77,056 KB |
testcase_72 | AC | 95 ms
77,696 KB |
testcase_73 | AC | 78 ms
74,112 KB |
testcase_74 | AC | 99 ms
77,432 KB |
testcase_75 | AC | 99 ms
77,568 KB |
testcase_76 | AC | 68 ms
70,528 KB |
testcase_77 | AC | 98 ms
76,992 KB |
testcase_78 | AC | 113 ms
77,400 KB |
testcase_79 | AC | 107 ms
77,776 KB |
testcase_80 | AC | 102 ms
77,336 KB |
testcase_81 | AC | 97 ms
77,356 KB |
testcase_82 | AC | 101 ms
77,824 KB |
testcase_83 | AC | 287 ms
94,080 KB |
testcase_84 | AC | 256 ms
93,836 KB |
testcase_85 | AC | 180 ms
87,896 KB |
testcase_86 | AC | 236 ms
91,200 KB |
testcase_87 | AC | 245 ms
92,928 KB |
testcase_88 | AC | 111 ms
78,200 KB |
testcase_89 | AC | 254 ms
93,908 KB |
testcase_90 | AC | 189 ms
88,448 KB |
testcase_91 | AC | 176 ms
85,980 KB |
testcase_92 | AC | 131 ms
81,664 KB |
testcase_93 | AC | 214 ms
90,648 KB |
testcase_94 | AC | 225 ms
89,216 KB |
testcase_95 | AC | 228 ms
89,320 KB |
testcase_96 | AC | 286 ms
93,860 KB |
testcase_97 | AC | 164 ms
84,224 KB |
testcase_98 | AC | 264 ms
94,080 KB |
testcase_99 | AC | 193 ms
87,536 KB |
testcase_100 | AC | 243 ms
94,400 KB |
testcase_101 | AC | 139 ms
80,920 KB |
testcase_102 | AC | 111 ms
77,952 KB |
testcase_103 | AC | 132 ms
81,536 KB |
testcase_104 | AC | 152 ms
82,688 KB |
testcase_105 | AC | 210 ms
90,860 KB |
testcase_106 | AC | 166 ms
84,968 KB |
testcase_107 | AC | 280 ms
94,336 KB |
testcase_108 | AC | 257 ms
94,128 KB |
testcase_109 | AC | 233 ms
90,580 KB |
testcase_110 | AC | 196 ms
88,448 KB |
testcase_111 | AC | 241 ms
89,600 KB |
testcase_112 | AC | 153 ms
83,200 KB |
testcase_113 | AC | 222 ms
89,236 KB |
testcase_114 | AC | 173 ms
84,328 KB |
testcase_115 | AC | 112 ms
78,200 KB |
testcase_116 | AC | 183 ms
85,888 KB |
testcase_117 | AC | 155 ms
83,072 KB |
testcase_118 | AC | 230 ms
93,288 KB |
testcase_119 | AC | 199 ms
87,040 KB |
testcase_120 | AC | 235 ms
92,928 KB |
testcase_121 | AC | 141 ms
82,052 KB |
testcase_122 | AC | 157 ms
84,464 KB |
testcase_123 | AC | 37 ms
51,840 KB |
testcase_124 | AC | 490 ms
202,496 KB |
testcase_125 | AC | 505 ms
202,368 KB |
ソースコード
import sys sys.setrecursionlimit(10**9) pos=-1 def dfs(G,v,p): global pos seen[v]=True hist.append(v) for nv in G[v]: if nv==p: continue if finished[nv]: continue if seen[nv] and (not finished[nv]): pos=nv return dfs(G,nv,v) if pos!=-1: return hist.pop() finished[v]=True N=int(input()) G=[[] for _ in range(N)] Edge=[] for i in range(N): a,b=map(lambda x:int(x)-1,input().split()) G[a].append(b) G[b].append(a) Edge.append((a,b)) seen=[False]*N finished=[False]*N hist=[] dfs(G,0,-1) cycle=set() while(hist): t=hist[-1] cycle.add(t) hist.pop() if t==pos: break ans=[] for i,e in enumerate(Edge): if e[0] in cycle and e[1] in cycle: ans.append(i+1) print(len(ans)) print(*ans)