結果

問題 No.2427 Tree Distance Two
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-08-24 21:08:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 760 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 86,808 KB
実行使用メモリ 126,888 KB
最終ジャッジ日時 2023-08-24 21:08:50
合計ジャッジ時間 20,258 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
72,904 KB
testcase_01 AC 103 ms
73,004 KB
testcase_02 AC 103 ms
72,652 KB
testcase_03 AC 760 ms
118,868 KB
testcase_04 AC 103 ms
72,696 KB
testcase_05 AC 706 ms
118,708 KB
testcase_06 AC 104 ms
72,736 KB
testcase_07 AC 539 ms
125,124 KB
testcase_08 AC 599 ms
126,068 KB
testcase_09 AC 537 ms
124,904 KB
testcase_10 AC 587 ms
126,888 KB
testcase_11 AC 587 ms
123,876 KB
testcase_12 AC 660 ms
122,164 KB
testcase_13 AC 675 ms
120,448 KB
testcase_14 AC 328 ms
116,664 KB
testcase_15 AC 102 ms
72,668 KB
testcase_16 AC 129 ms
72,612 KB
testcase_17 AC 129 ms
72,684 KB
testcase_18 AC 103 ms
72,956 KB
testcase_19 AC 102 ms
73,028 KB
testcase_20 AC 147 ms
80,988 KB
testcase_21 AC 149 ms
81,064 KB
testcase_22 AC 142 ms
80,320 KB
testcase_23 AC 137 ms
78,812 KB
testcase_24 AC 179 ms
81,044 KB
testcase_25 AC 276 ms
89,716 KB
testcase_26 AC 452 ms
103,612 KB
testcase_27 AC 337 ms
97,388 KB
testcase_28 AC 689 ms
115,224 KB
testcase_29 AC 579 ms
110,992 KB
testcase_30 AC 436 ms
103,180 KB
testcase_31 AC 311 ms
94,676 KB
testcase_32 AC 446 ms
102,952 KB
testcase_33 AC 392 ms
99,884 KB
testcase_34 AC 202 ms
86,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = int(input())
e = [[] for _ in range(N)]
for _ in range(N-1):
    u,v = map(int,input().split())
    u -= 1
    v -= 1
    e[u].append(v)
    e[v].append(u)
    
    
for i in range(N):
    
    x = sum(len(e[j]) for j in e[i])
    print(x-len(e[i]))
0