結果

問題 No.806 木を道に
ユーザー NoneNone
提出日時 2021-03-13 20:53:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,108 KB
実行使用メモリ 89,164 KB
最終ジャッジ日時 2024-04-23 11:04:13
合計ジャッジ時間 4,594 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,756 KB
testcase_01 AC 37 ms
53,176 KB
testcase_02 AC 39 ms
53,124 KB
testcase_03 AC 38 ms
53,236 KB
testcase_04 AC 39 ms
52,876 KB
testcase_05 AC 40 ms
53,808 KB
testcase_06 AC 39 ms
53,548 KB
testcase_07 AC 38 ms
52,804 KB
testcase_08 AC 38 ms
53,136 KB
testcase_09 AC 39 ms
53,144 KB
testcase_10 AC 94 ms
78,296 KB
testcase_11 AC 92 ms
77,896 KB
testcase_12 AC 169 ms
85,208 KB
testcase_13 AC 138 ms
82,476 KB
testcase_14 AC 172 ms
84,964 KB
testcase_15 AC 168 ms
85,292 KB
testcase_16 AC 102 ms
78,420 KB
testcase_17 AC 157 ms
84,544 KB
testcase_18 AC 83 ms
77,152 KB
testcase_19 AC 95 ms
78,248 KB
testcase_20 AC 158 ms
84,596 KB
testcase_21 AC 118 ms
80,988 KB
testcase_22 AC 189 ms
87,312 KB
testcase_23 AC 191 ms
87,680 KB
testcase_24 AC 104 ms
81,276 KB
testcase_25 AC 126 ms
84,692 KB
testcase_26 AC 91 ms
79,232 KB
testcase_27 AC 141 ms
89,164 KB
testcase_28 AC 67 ms
69,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    a,b=map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

res=0
for edge in edges:
    res+=max(len(edge)-2,0)

print(res)
0