結果

問題 No.806 木を道に
ユーザー shoooooshooooo
提出日時 2019-11-30 21:17:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 464 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 30,304 KB
最終ジャッジ日時 2023-08-13 09:43:24
合計ジャッジ時間 7,148 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,460 KB
testcase_01 AC 18 ms
8,516 KB
testcase_02 AC 18 ms
8,472 KB
testcase_03 AC 20 ms
8,392 KB
testcase_04 AC 20 ms
8,528 KB
testcase_05 AC 18 ms
8,544 KB
testcase_06 AC 18 ms
8,452 KB
testcase_07 AC 18 ms
8,480 KB
testcase_08 AC 17 ms
8,524 KB
testcase_09 AC 18 ms
8,460 KB
testcase_10 AC 111 ms
13,796 KB
testcase_11 AC 96 ms
12,196 KB
testcase_12 AC 378 ms
24,376 KB
testcase_13 AC 278 ms
20,628 KB
testcase_14 AC 361 ms
23,636 KB
testcase_15 AC 386 ms
24,632 KB
testcase_16 AC 143 ms
14,404 KB
testcase_17 AC 328 ms
22,684 KB
testcase_18 AC 50 ms
9,940 KB
testcase_19 AC 112 ms
13,524 KB
testcase_20 AC 328 ms
22,760 KB
testcase_21 AC 191 ms
16,300 KB
testcase_22 AC 464 ms
29,160 KB
testcase_23 AC 457 ms
29,120 KB
testcase_24 AC 216 ms
19,376 KB
testcase_25 AC 312 ms
23,568 KB
testcase_26 AC 132 ms
14,820 KB
testcase_27 AC 403 ms
30,304 KB
testcase_28 AC 30 ms
9,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N=int(input())
E=defaultdict(list)
for i in range(N-1):
  a,b=map(int,input().split())
  E[a].append(b)
  E[b].append(a)
ans=0
for i in range(1,N+1):
  ans+=max(len(E[i])-2,0)
print(ans)
0