結果

問題 No.1254 補強への架け橋
ユーザー 37zigen37zigen
提出日時 2020-10-10 00:44:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 618 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 39,096 KB
最終ジャッジ日時 2023-09-27 20:29:44
合計ジャッジ時間 26,793 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,712 KB
testcase_01 AC 15 ms
7,852 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 16 ms
7,808 KB
testcase_04 AC 16 ms
7,844 KB
testcase_05 AC 16 ms
7,864 KB
testcase_06 AC 16 ms
7,712 KB
testcase_07 AC 16 ms
7,708 KB
testcase_08 AC 16 ms
7,904 KB
testcase_09 AC 16 ms
7,848 KB
testcase_10 AC 15 ms
7,920 KB
testcase_11 AC 16 ms
7,780 KB
testcase_12 AC 16 ms
7,908 KB
testcase_13 AC 17 ms
7,752 KB
testcase_14 AC 16 ms
7,772 KB
testcase_15 AC 16 ms
7,716 KB
testcase_16 AC 16 ms
7,912 KB
testcase_17 AC 16 ms
7,708 KB
testcase_18 AC 16 ms
7,860 KB
testcase_19 AC 16 ms
7,760 KB
testcase_20 AC 16 ms
7,708 KB
testcase_21 AC 16 ms
7,792 KB
testcase_22 AC 16 ms
7,788 KB
testcase_23 AC 16 ms
7,768 KB
testcase_24 AC 17 ms
7,732 KB
testcase_25 AC 16 ms
7,800 KB
testcase_26 AC 17 ms
7,708 KB
testcase_27 AC 17 ms
7,716 KB
testcase_28 AC 16 ms
7,860 KB
testcase_29 AC 16 ms
7,928 KB
testcase_30 AC 16 ms
7,884 KB
testcase_31 AC 16 ms
7,820 KB
testcase_32 AC 16 ms
7,716 KB
testcase_33 AC 16 ms
7,780 KB
testcase_34 AC 16 ms
7,908 KB
testcase_35 AC 17 ms
7,912 KB
testcase_36 AC 16 ms
7,912 KB
testcase_37 AC 16 ms
7,804 KB
testcase_38 AC 16 ms
7,816 KB
testcase_39 AC 16 ms
7,876 KB
testcase_40 AC 16 ms
7,860 KB
testcase_41 AC 16 ms
7,720 KB
testcase_42 AC 16 ms
7,864 KB
testcase_43 AC 19 ms
8,512 KB
testcase_44 AC 18 ms
8,340 KB
testcase_45 AC 18 ms
8,196 KB
testcase_46 AC 19 ms
8,452 KB
testcase_47 AC 18 ms
8,340 KB
testcase_48 AC 18 ms
8,404 KB
testcase_49 AC 17 ms
7,848 KB
testcase_50 AC 20 ms
8,380 KB
testcase_51 AC 20 ms
8,376 KB
testcase_52 AC 20 ms
8,436 KB
testcase_53 AC 19 ms
8,360 KB
testcase_54 AC 20 ms
8,508 KB
testcase_55 AC 19 ms
8,444 KB
testcase_56 AC 17 ms
7,856 KB
testcase_57 AC 19 ms
8,296 KB
testcase_58 AC 19 ms
8,200 KB
testcase_59 AC 16 ms
7,860 KB
testcase_60 AC 17 ms
8,340 KB
testcase_61 AC 20 ms
8,460 KB
testcase_62 AC 17 ms
7,760 KB
testcase_63 AC 64 ms
10,748 KB
testcase_64 AC 28 ms
8,728 KB
testcase_65 AC 47 ms
9,896 KB
testcase_66 AC 40 ms
9,464 KB
testcase_67 AC 26 ms
8,632 KB
testcase_68 AC 43 ms
9,612 KB
testcase_69 AC 51 ms
10,156 KB
testcase_70 AC 31 ms
8,848 KB
testcase_71 AC 27 ms
8,932 KB
testcase_72 AC 51 ms
10,000 KB
testcase_73 AC 30 ms
8,844 KB
testcase_74 AC 49 ms
10,168 KB
testcase_75 AC 41 ms
9,668 KB
testcase_76 AC 21 ms
8,404 KB
testcase_77 AC 38 ms
9,376 KB
testcase_78 AC 60 ms
10,508 KB
testcase_79 AC 62 ms
10,484 KB
testcase_80 AC 55 ms
10,424 KB
testcase_81 AC 61 ms
10,408 KB
testcase_82 AC 57 ms
10,380 KB
testcase_83 AC 601 ms
33,736 KB
testcase_84 AC 579 ms
33,004 KB
testcase_85 AC 359 ms
23,908 KB
testcase_86 AC 502 ms
29,756 KB
testcase_87 AC 554 ms
31,764 KB
testcase_88 AC 89 ms
11,976 KB
testcase_89 AC 599 ms
33,724 KB
testcase_90 AC 378 ms
24,680 KB
testcase_91 AC 299 ms
21,408 KB
testcase_92 AC 152 ms
15,292 KB
testcase_93 AC 473 ms
28,612 KB
testcase_94 AC 429 ms
26,688 KB
testcase_95 AC 423 ms
26,772 KB
testcase_96 AC 556 ms
32,200 KB
testcase_97 AC 245 ms
19,280 KB
testcase_98 AC 564 ms
32,600 KB
testcase_99 AC 348 ms
23,284 KB
testcase_100 AC 618 ms
34,388 KB
testcase_101 AC 142 ms
14,368 KB
testcase_102 AC 79 ms
11,580 KB
testcase_103 AC 156 ms
15,016 KB
testcase_104 AC 211 ms
17,804 KB
testcase_105 AC 475 ms
28,716 KB
testcase_106 AC 284 ms
20,492 KB
testcase_107 AC 591 ms
33,580 KB
testcase_108 AC 586 ms
33,440 KB
testcase_109 AC 466 ms
28,420 KB
testcase_110 AC 428 ms
26,476 KB
testcase_111 AC 459 ms
27,800 KB
testcase_112 AC 196 ms
17,252 KB
testcase_113 AC 414 ms
26,016 KB
testcase_114 AC 263 ms
20,140 KB
testcase_115 AC 97 ms
12,352 KB
testcase_116 AC 318 ms
21,840 KB
testcase_117 AC 198 ms
17,264 KB
testcase_118 AC 563 ms
32,156 KB
testcase_119 AC 338 ms
23,036 KB
testcase_120 AC 552 ms
31,432 KB
testcase_121 AC 169 ms
15,752 KB
testcase_122 AC 307 ms
21,724 KB
testcase_123 AC 16 ms
7,768 KB
testcase_124 AC 564 ms
39,096 KB
testcase_125 AC 564 ms
39,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0