結果

問題 No.2427 Tree Distance Two
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 21:21:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 610 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 152,388 KB
最終ジャッジ日時 2023-08-18 21:22:14
合計ジャッジ時間 14,288 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,088 KB
testcase_01 AC 67 ms
71,284 KB
testcase_02 AC 68 ms
70,952 KB
testcase_03 AC 597 ms
136,992 KB
testcase_04 AC 67 ms
71,392 KB
testcase_05 AC 610 ms
136,972 KB
testcase_06 AC 75 ms
71,396 KB
testcase_07 AC 427 ms
149,984 KB
testcase_08 AC 499 ms
149,760 KB
testcase_09 AC 449 ms
145,924 KB
testcase_10 AC 467 ms
152,388 KB
testcase_11 AC 485 ms
150,016 KB
testcase_12 AC 516 ms
144,260 KB
testcase_13 AC 562 ms
145,680 KB
testcase_14 AC 286 ms
139,520 KB
testcase_15 AC 68 ms
71,348 KB
testcase_16 AC 68 ms
71,348 KB
testcase_17 AC 66 ms
71,228 KB
testcase_18 AC 68 ms
71,408 KB
testcase_19 AC 70 ms
71,144 KB
testcase_20 AC 100 ms
78,820 KB
testcase_21 AC 101 ms
78,452 KB
testcase_22 AC 91 ms
76,880 KB
testcase_23 AC 89 ms
76,520 KB
testcase_24 AC 99 ms
78,892 KB
testcase_25 AC 186 ms
93,688 KB
testcase_26 AC 444 ms
119,280 KB
testcase_27 AC 281 ms
103,580 KB
testcase_28 AC 570 ms
139,284 KB
testcase_29 AC 514 ms
131,872 KB
testcase_30 AC 380 ms
113,524 KB
testcase_31 AC 245 ms
102,956 KB
testcase_32 AC 363 ms
110,908 KB
testcase_33 AC 322 ms
111,952 KB
testcase_34 AC 150 ms
87,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""


"""

import sys
from sys import stdin

N = int(stdin.readline())

lis = [ [] for i in range(N) ]

for i in range(N-1):

    u,v = map(int,stdin.readline().split())
    u -= 1
    v -= 1

    lis[u].append(v)
    lis[v].append(u)

ans = []

for v in range(N):

    now = 0
    for nex in lis[v]:
        now += len(lis[nex])-1

    ans.append(now)

print (*ans,sep="\n")
0