結果
問題 | No.1254 補強への架け橋 |
ユーザー | titia |
提出日時 | 2020-10-10 01:01:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 388 ms / 2,000 ms |
コード長 | 968 bytes |
コンパイル時間 | 530 ms |
コンパイル使用メモリ | 81,848 KB |
実行使用メモリ | 145,108 KB |
最終ジャッジ日時 | 2024-07-20 15:07:11 |
合計ジャッジ時間 | 20,936 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,556 KB |
testcase_01 | AC | 39 ms
52,808 KB |
testcase_02 | AC | 38 ms
52,396 KB |
testcase_03 | AC | 40 ms
52,416 KB |
testcase_04 | AC | 40 ms
54,164 KB |
testcase_05 | AC | 39 ms
53,012 KB |
testcase_06 | AC | 38 ms
52,416 KB |
testcase_07 | AC | 37 ms
53,496 KB |
testcase_08 | AC | 40 ms
52,432 KB |
testcase_09 | AC | 38 ms
52,932 KB |
testcase_10 | AC | 38 ms
52,504 KB |
testcase_11 | AC | 38 ms
53,152 KB |
testcase_12 | AC | 38 ms
52,684 KB |
testcase_13 | AC | 40 ms
53,308 KB |
testcase_14 | AC | 39 ms
53,092 KB |
testcase_15 | AC | 39 ms
52,744 KB |
testcase_16 | AC | 38 ms
53,720 KB |
testcase_17 | AC | 39 ms
52,868 KB |
testcase_18 | AC | 38 ms
52,944 KB |
testcase_19 | AC | 38 ms
53,376 KB |
testcase_20 | AC | 39 ms
54,200 KB |
testcase_21 | AC | 38 ms
52,884 KB |
testcase_22 | AC | 39 ms
53,780 KB |
testcase_23 | AC | 39 ms
52,076 KB |
testcase_24 | AC | 39 ms
54,372 KB |
testcase_25 | AC | 37 ms
52,276 KB |
testcase_26 | AC | 39 ms
53,312 KB |
testcase_27 | AC | 39 ms
52,732 KB |
testcase_28 | AC | 40 ms
52,976 KB |
testcase_29 | AC | 39 ms
53,916 KB |
testcase_30 | AC | 39 ms
52,400 KB |
testcase_31 | AC | 38 ms
52,956 KB |
testcase_32 | AC | 38 ms
53,576 KB |
testcase_33 | AC | 39 ms
52,996 KB |
testcase_34 | AC | 39 ms
52,468 KB |
testcase_35 | AC | 39 ms
53,184 KB |
testcase_36 | AC | 39 ms
54,324 KB |
testcase_37 | AC | 39 ms
54,212 KB |
testcase_38 | AC | 39 ms
53,352 KB |
testcase_39 | AC | 39 ms
53,504 KB |
testcase_40 | AC | 39 ms
52,864 KB |
testcase_41 | AC | 38 ms
54,336 KB |
testcase_42 | AC | 37 ms
52,496 KB |
testcase_43 | AC | 56 ms
65,596 KB |
testcase_44 | AC | 45 ms
59,940 KB |
testcase_45 | AC | 45 ms
59,936 KB |
testcase_46 | AC | 53 ms
63,196 KB |
testcase_47 | AC | 48 ms
61,908 KB |
testcase_48 | AC | 52 ms
62,096 KB |
testcase_49 | AC | 40 ms
54,280 KB |
testcase_50 | AC | 55 ms
64,100 KB |
testcase_51 | AC | 55 ms
65,164 KB |
testcase_52 | AC | 56 ms
65,040 KB |
testcase_53 | AC | 54 ms
64,172 KB |
testcase_54 | AC | 56 ms
64,796 KB |
testcase_55 | AC | 54 ms
64,516 KB |
testcase_56 | AC | 41 ms
53,248 KB |
testcase_57 | AC | 52 ms
61,844 KB |
testcase_58 | AC | 51 ms
63,080 KB |
testcase_59 | AC | 40 ms
54,180 KB |
testcase_60 | AC | 45 ms
59,564 KB |
testcase_61 | AC | 56 ms
64,832 KB |
testcase_62 | AC | 40 ms
53,276 KB |
testcase_63 | AC | 94 ms
77,676 KB |
testcase_64 | AC | 85 ms
76,988 KB |
testcase_65 | AC | 90 ms
77,260 KB |
testcase_66 | AC | 89 ms
77,380 KB |
testcase_67 | AC | 74 ms
73,852 KB |
testcase_68 | AC | 91 ms
77,476 KB |
testcase_69 | AC | 94 ms
77,500 KB |
testcase_70 | AC | 86 ms
77,264 KB |
testcase_71 | AC | 84 ms
76,928 KB |
testcase_72 | AC | 94 ms
77,112 KB |
testcase_73 | AC | 81 ms
76,964 KB |
testcase_74 | AC | 86 ms
77,180 KB |
testcase_75 | AC | 92 ms
77,484 KB |
testcase_76 | AC | 69 ms
71,500 KB |
testcase_77 | AC | 89 ms
77,192 KB |
testcase_78 | AC | 85 ms
77,088 KB |
testcase_79 | AC | 94 ms
77,212 KB |
testcase_80 | AC | 90 ms
77,132 KB |
testcase_81 | AC | 94 ms
77,284 KB |
testcase_82 | AC | 92 ms
77,392 KB |
testcase_83 | AC | 240 ms
96,852 KB |
testcase_84 | AC | 222 ms
96,288 KB |
testcase_85 | AC | 162 ms
89,116 KB |
testcase_86 | AC | 203 ms
93,628 KB |
testcase_87 | AC | 209 ms
94,892 KB |
testcase_88 | AC | 97 ms
77,476 KB |
testcase_89 | AC | 221 ms
96,716 KB |
testcase_90 | AC | 173 ms
89,624 KB |
testcase_91 | AC | 155 ms
86,880 KB |
testcase_92 | AC | 118 ms
79,252 KB |
testcase_93 | AC | 195 ms
93,064 KB |
testcase_94 | AC | 179 ms
90,972 KB |
testcase_95 | AC | 177 ms
91,100 KB |
testcase_96 | AC | 207 ms
95,888 KB |
testcase_97 | AC | 137 ms
82,672 KB |
testcase_98 | AC | 234 ms
95,968 KB |
testcase_99 | AC | 170 ms
88,432 KB |
testcase_100 | AC | 224 ms
97,128 KB |
testcase_101 | AC | 112 ms
80,304 KB |
testcase_102 | AC | 98 ms
77,492 KB |
testcase_103 | AC | 115 ms
79,564 KB |
testcase_104 | AC | 131 ms
83,992 KB |
testcase_105 | AC | 196 ms
93,024 KB |
testcase_106 | AC | 145 ms
85,952 KB |
testcase_107 | AC | 218 ms
96,812 KB |
testcase_108 | AC | 234 ms
96,780 KB |
testcase_109 | AC | 193 ms
92,800 KB |
testcase_110 | AC | 183 ms
90,868 KB |
testcase_111 | AC | 189 ms
91,992 KB |
testcase_112 | AC | 128 ms
83,396 KB |
testcase_113 | AC | 183 ms
90,504 KB |
testcase_114 | AC | 141 ms
86,172 KB |
testcase_115 | AC | 104 ms
79,860 KB |
testcase_116 | AC | 151 ms
87,076 KB |
testcase_117 | AC | 126 ms
83,528 KB |
testcase_118 | AC | 214 ms
95,644 KB |
testcase_119 | AC | 160 ms
88,748 KB |
testcase_120 | AC | 220 ms
94,796 KB |
testcase_121 | AC | 110 ms
79,412 KB |
testcase_122 | AC | 157 ms
87,024 KB |
testcase_123 | AC | 38 ms
52,908 KB |
testcase_124 | AC | 388 ms
145,104 KB |
testcase_125 | AC | 384 ms
145,108 KB |
ソースコード
N=int(input()) EDGE=[tuple(map(int,input().split())) for i in range(N)] E=[[] for i in range(N+1)] for x,y in EDGE: E[x].append(y) E[y].append(x) Q=[(1,N+5)] USE=[0]*(N+1) FR=[-1]*(N+1) USE[1]=1 while Q: x,fr=Q.pop() ANS=-1 for to in E[x]: if fr==to: continue if USE[to]==0: USE[to]=1 FR[to]=x Q.append((to,x)) else: ANS=to NOW=x break if ANS!=-1: break LIST0=[] LIST1=[] while NOW!=1: LIST0.append(NOW) NOW=FR[NOW] while ANS!=1: LIST1.append(ANS) ANS=FR[ANS] LIST0.append(1) LIST1.append(1) while LIST0[-1]==LIST1[-1]: x=LIST0.pop() y=LIST1.pop() LIST=[x]+LIST0[::-1]+LIST1 SET=set() for i in range(len(LIST)): x=LIST[i-1] y=LIST[i] SET.add((x,y)) SET.add((y,x)) ALIST=[] for i in range(N): if EDGE[i] in SET: ALIST.append(i+1) print(len(ALIST)) print(*ALIST)