結果
問題 | No.1254 補強への架け橋 |
ユーザー | 37zigen |
提出日時 | 2020-10-10 00:44:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 633 ms / 2,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 321 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 41,472 KB |
最終ジャッジ日時 | 2024-07-20 15:03:25 |
合計ジャッジ時間 | 28,502 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
10,624 KB |
testcase_01 | AC | 28 ms
10,624 KB |
testcase_02 | AC | 31 ms
10,624 KB |
testcase_03 | AC | 28 ms
10,624 KB |
testcase_04 | AC | 29 ms
10,624 KB |
testcase_05 | AC | 27 ms
10,624 KB |
testcase_06 | AC | 27 ms
10,496 KB |
testcase_07 | AC | 28 ms
10,624 KB |
testcase_08 | AC | 26 ms
10,752 KB |
testcase_09 | AC | 26 ms
10,752 KB |
testcase_10 | AC | 27 ms
10,880 KB |
testcase_11 | AC | 27 ms
10,752 KB |
testcase_12 | AC | 27 ms
10,752 KB |
testcase_13 | AC | 28 ms
10,752 KB |
testcase_14 | AC | 28 ms
10,880 KB |
testcase_15 | AC | 30 ms
10,752 KB |
testcase_16 | AC | 29 ms
10,624 KB |
testcase_17 | AC | 28 ms
10,752 KB |
testcase_18 | AC | 27 ms
10,752 KB |
testcase_19 | AC | 26 ms
10,752 KB |
testcase_20 | AC | 28 ms
10,624 KB |
testcase_21 | AC | 28 ms
10,752 KB |
testcase_22 | AC | 26 ms
10,752 KB |
testcase_23 | AC | 28 ms
10,752 KB |
testcase_24 | AC | 28 ms
10,752 KB |
testcase_25 | AC | 28 ms
10,752 KB |
testcase_26 | AC | 28 ms
10,752 KB |
testcase_27 | AC | 29 ms
10,880 KB |
testcase_28 | AC | 29 ms
10,624 KB |
testcase_29 | AC | 26 ms
10,752 KB |
testcase_30 | AC | 27 ms
10,752 KB |
testcase_31 | AC | 29 ms
10,752 KB |
testcase_32 | AC | 29 ms
10,624 KB |
testcase_33 | AC | 29 ms
10,752 KB |
testcase_34 | AC | 27 ms
10,752 KB |
testcase_35 | AC | 28 ms
10,752 KB |
testcase_36 | AC | 26 ms
10,752 KB |
testcase_37 | AC | 28 ms
10,752 KB |
testcase_38 | AC | 27 ms
10,752 KB |
testcase_39 | AC | 28 ms
10,752 KB |
testcase_40 | AC | 28 ms
10,624 KB |
testcase_41 | AC | 28 ms
10,752 KB |
testcase_42 | AC | 28 ms
10,624 KB |
testcase_43 | AC | 31 ms
10,880 KB |
testcase_44 | AC | 28 ms
10,752 KB |
testcase_45 | AC | 29 ms
10,880 KB |
testcase_46 | AC | 33 ms
10,752 KB |
testcase_47 | AC | 31 ms
10,880 KB |
testcase_48 | AC | 33 ms
10,752 KB |
testcase_49 | AC | 30 ms
10,752 KB |
testcase_50 | AC | 34 ms
10,880 KB |
testcase_51 | AC | 32 ms
10,880 KB |
testcase_52 | AC | 32 ms
10,880 KB |
testcase_53 | AC | 32 ms
10,752 KB |
testcase_54 | AC | 32 ms
10,880 KB |
testcase_55 | AC | 31 ms
10,624 KB |
testcase_56 | AC | 27 ms
10,752 KB |
testcase_57 | AC | 29 ms
10,880 KB |
testcase_58 | AC | 32 ms
10,752 KB |
testcase_59 | AC | 29 ms
10,624 KB |
testcase_60 | AC | 30 ms
10,752 KB |
testcase_61 | AC | 31 ms
10,880 KB |
testcase_62 | AC | 28 ms
10,752 KB |
testcase_63 | AC | 78 ms
13,184 KB |
testcase_64 | AC | 40 ms
11,264 KB |
testcase_65 | AC | 63 ms
12,288 KB |
testcase_66 | AC | 53 ms
12,032 KB |
testcase_67 | AC | 35 ms
11,136 KB |
testcase_68 | AC | 55 ms
12,160 KB |
testcase_69 | AC | 63 ms
12,416 KB |
testcase_70 | AC | 43 ms
11,520 KB |
testcase_71 | AC | 39 ms
11,264 KB |
testcase_72 | AC | 64 ms
12,672 KB |
testcase_73 | AC | 40 ms
11,392 KB |
testcase_74 | AC | 60 ms
12,544 KB |
testcase_75 | AC | 54 ms
11,904 KB |
testcase_76 | AC | 34 ms
10,880 KB |
testcase_77 | AC | 53 ms
11,648 KB |
testcase_78 | AC | 73 ms
13,056 KB |
testcase_79 | AC | 74 ms
13,184 KB |
testcase_80 | AC | 71 ms
12,800 KB |
testcase_81 | AC | 74 ms
13,056 KB |
testcase_82 | AC | 74 ms
12,800 KB |
testcase_83 | AC | 611 ms
36,224 KB |
testcase_84 | AC | 581 ms
35,456 KB |
testcase_85 | AC | 358 ms
26,240 KB |
testcase_86 | AC | 498 ms
32,256 KB |
testcase_87 | AC | 567 ms
34,304 KB |
testcase_88 | AC | 106 ms
14,464 KB |
testcase_89 | AC | 611 ms
36,096 KB |
testcase_90 | AC | 389 ms
27,136 KB |
testcase_91 | AC | 313 ms
23,808 KB |
testcase_92 | AC | 175 ms
17,536 KB |
testcase_93 | AC | 508 ms
31,104 KB |
testcase_94 | AC | 462 ms
29,312 KB |
testcase_95 | AC | 470 ms
29,184 KB |
testcase_96 | AC | 620 ms
34,816 KB |
testcase_97 | AC | 275 ms
21,888 KB |
testcase_98 | AC | 602 ms
35,072 KB |
testcase_99 | AC | 353 ms
25,600 KB |
testcase_100 | AC | 633 ms
36,736 KB |
testcase_101 | AC | 158 ms
16,896 KB |
testcase_102 | AC | 97 ms
13,952 KB |
testcase_103 | AC | 168 ms
17,536 KB |
testcase_104 | AC | 228 ms
20,224 KB |
testcase_105 | AC | 500 ms
31,232 KB |
testcase_106 | AC | 294 ms
22,912 KB |
testcase_107 | AC | 610 ms
35,968 KB |
testcase_108 | AC | 632 ms
35,712 KB |
testcase_109 | AC | 506 ms
30,976 KB |
testcase_110 | AC | 441 ms
28,928 KB |
testcase_111 | AC | 492 ms
30,336 KB |
testcase_112 | AC | 223 ms
19,712 KB |
testcase_113 | AC | 441 ms
28,544 KB |
testcase_114 | AC | 285 ms
22,528 KB |
testcase_115 | AC | 112 ms
14,720 KB |
testcase_116 | AC | 333 ms
24,320 KB |
testcase_117 | AC | 219 ms
19,712 KB |
testcase_118 | AC | 583 ms
34,688 KB |
testcase_119 | AC | 361 ms
25,472 KB |
testcase_120 | AC | 562 ms
33,920 KB |
testcase_121 | AC | 184 ms
18,176 KB |
testcase_122 | AC | 325 ms
23,936 KB |
testcase_123 | AC | 28 ms
10,752 KB |
testcase_124 | AC | 606 ms
41,344 KB |
testcase_125 | AC | 605 ms
41,472 KB |
ソースコード
import sys sys.setrecursionlimit(10**6) N=int(input()) g=[[] for i in range(N+1)] d=[0]*(N+1) e=[] ok=[True]*(N+1) id=dict() for i in range(N): a,b=map(int,input().split()) g[a].append(b) g[b].append(a) d[a]+=1 d[b]+=1 e.append((a,b)) stk=[] for i in range(N): if d[i+1]==1: stk.append(i+1) while stk: v=stk.pop() if d[v]<=0: continue for u in g[v]: d[u]-=1 d[v]-=1 if d[u]==1: stk.append(u) ans=[] for i in range(N): if d[e[i][0]]>0 and d[e[i][1]]>0: ans.append(i+1) print(len(ans)) print(*ans)