結果

問題 No.806 木を道に
ユーザー shoooooshooooo
提出日時 2019-11-30 21:17:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 513 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,720 KB
最終ジャッジ日時 2024-05-01 03:15:21
合計ジャッジ時間 6,644 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,624 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 28 ms
10,624 KB
testcase_08 AC 29 ms
10,624 KB
testcase_09 AC 29 ms
10,624 KB
testcase_10 AC 134 ms
16,100 KB
testcase_11 AC 112 ms
14,452 KB
testcase_12 AC 411 ms
26,828 KB
testcase_13 AC 297 ms
22,992 KB
testcase_14 AC 392 ms
26,092 KB
testcase_15 AC 417 ms
26,948 KB
testcase_16 AC 163 ms
16,972 KB
testcase_17 AC 367 ms
25,112 KB
testcase_18 AC 61 ms
12,672 KB
testcase_19 AC 130 ms
15,972 KB
testcase_20 AC 361 ms
24,996 KB
testcase_21 AC 220 ms
18,664 KB
testcase_22 AC 488 ms
31,636 KB
testcase_23 AC 513 ms
31,656 KB
testcase_24 AC 230 ms
21,680 KB
testcase_25 AC 341 ms
25,900 KB
testcase_26 AC 149 ms
16,904 KB
testcase_27 AC 419 ms
32,720 KB
testcase_28 AC 36 ms
11,264 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