結果

問題 No.2427 Tree Distance Two
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 21:21:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,136 KB
実行使用メモリ 151,040 KB
最終ジャッジ日時 2024-05-06 03:09:33
合計ジャッジ時間 10,248 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 35 ms
51,584 KB
testcase_02 AC 35 ms
51,840 KB
testcase_03 AC 522 ms
138,368 KB
testcase_04 AC 36 ms
51,456 KB
testcase_05 AC 524 ms
138,124 KB
testcase_06 AC 35 ms
51,840 KB
testcase_07 AC 381 ms
149,392 KB
testcase_08 AC 420 ms
149,248 KB
testcase_09 AC 388 ms
150,144 KB
testcase_10 AC 407 ms
151,040 KB
testcase_11 AC 417 ms
149,460 KB
testcase_12 AC 454 ms
142,120 KB
testcase_13 AC 477 ms
137,936 KB
testcase_14 AC 231 ms
138,624 KB
testcase_15 AC 36 ms
51,840 KB
testcase_16 AC 35 ms
51,968 KB
testcase_17 AC 36 ms
51,840 KB
testcase_18 AC 38 ms
52,224 KB
testcase_19 AC 35 ms
52,096 KB
testcase_20 AC 62 ms
73,616 KB
testcase_21 AC 73 ms
77,628 KB
testcase_22 AC 60 ms
67,968 KB
testcase_23 AC 57 ms
66,432 KB
testcase_24 AC 62 ms
73,856 KB
testcase_25 AC 133 ms
92,968 KB
testcase_26 AC 294 ms
117,952 KB
testcase_27 AC 219 ms
105,216 KB
testcase_28 AC 461 ms
138,624 KB
testcase_29 AC 418 ms
130,816 KB
testcase_30 AC 296 ms
107,012 KB
testcase_31 AC 198 ms
102,144 KB
testcase_32 AC 297 ms
112,072 KB
testcase_33 AC 267 ms
110,848 KB
testcase_34 AC 110 ms
86,272 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