結果

問題 No.2427 Tree Distance Two
ユーザー miho-4miho-4
提出日時 2023-08-18 21:38:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 870 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 126,648 KB
最終ジャッジ日時 2023-08-18 21:39:35
合計ジャッジ時間 16,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,736 KB
testcase_01 AC 94 ms
71,736 KB
testcase_02 AC 116 ms
71,772 KB
testcase_03 AC 870 ms
113,888 KB
testcase_04 AC 93 ms
71,660 KB
testcase_05 AC 787 ms
113,904 KB
testcase_06 AC 107 ms
71,640 KB
testcase_07 AC 579 ms
126,648 KB
testcase_08 AC 683 ms
125,992 KB
testcase_09 AC 732 ms
125,380 KB
testcase_10 AC 633 ms
126,120 KB
testcase_11 AC 693 ms
124,784 KB
testcase_12 AC 722 ms
122,760 KB
testcase_13 AC 746 ms
118,100 KB
testcase_14 AC 387 ms
112,092 KB
testcase_15 AC 97 ms
71,716 KB
testcase_16 AC 109 ms
71,596 KB
testcase_17 AC 95 ms
71,700 KB
testcase_18 AC 108 ms
71,488 KB
testcase_19 AC 96 ms
71,564 KB
testcase_20 AC 147 ms
79,220 KB
testcase_21 AC 152 ms
79,744 KB
testcase_22 AC 136 ms
78,156 KB
testcase_23 AC 136 ms
78,140 KB
testcase_24 AC 164 ms
79,388 KB
testcase_25 AC 303 ms
87,152 KB
testcase_26 AC 594 ms
100,140 KB
testcase_27 AC 437 ms
94,356 KB
testcase_28 AC 725 ms
111,736 KB
testcase_29 AC 729 ms
107,104 KB
testcase_30 AC 493 ms
99,572 KB
testcase_31 AC 409 ms
92,144 KB
testcase_32 AC 574 ms
99,340 KB
testcase_33 AC 481 ms
97,016 KB
testcase_34 AC 220 ms
83,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n=int(input())
E=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int,input().split())
  E[a].append(b)
  E[b].append(a)
  
for i in range(1,n+1):
  ans=0
  for e in E[i]:
    ans+=len(E[e])-1
  print(ans)
0