結果

問題 No.2427 Tree Distance Two
ユーザー loop0919loop0919
提出日時 2023-08-18 22:13:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 858 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 198,272 KB
最終ジャッジ日時 2024-05-06 04:21:52
合計ジャッジ時間 14,764 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,456 KB
testcase_01 AC 35 ms
51,840 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 858 ms
161,400 KB
testcase_04 AC 34 ms
51,584 KB
testcase_05 AC 838 ms
161,024 KB
testcase_06 AC 36 ms
51,712 KB
testcase_07 AC 643 ms
196,040 KB
testcase_08 AC 721 ms
191,736 KB
testcase_09 AC 676 ms
192,384 KB
testcase_10 AC 692 ms
198,272 KB
testcase_11 AC 692 ms
192,188 KB
testcase_12 AC 740 ms
185,604 KB
testcase_13 AC 780 ms
177,864 KB
testcase_14 AC 382 ms
160,896 KB
testcase_15 AC 35 ms
51,840 KB
testcase_16 AC 36 ms
52,480 KB
testcase_17 AC 33 ms
51,968 KB
testcase_18 AC 35 ms
52,992 KB
testcase_19 AC 33 ms
52,096 KB
testcase_20 AC 89 ms
78,080 KB
testcase_21 AC 92 ms
78,072 KB
testcase_22 AC 78 ms
77,300 KB
testcase_23 AC 77 ms
76,752 KB
testcase_24 AC 90 ms
77,952 KB
testcase_25 AC 231 ms
98,432 KB
testcase_26 AC 492 ms
129,408 KB
testcase_27 AC 350 ms
114,068 KB
testcase_28 AC 770 ms
155,264 KB
testcase_29 AC 667 ms
145,280 KB
testcase_30 AC 491 ms
128,128 KB
testcase_31 AC 320 ms
109,344 KB
testcase_32 AC 484 ms
127,360 KB
testcase_33 AC 428 ms
120,832 KB
testcase_34 AC 159 ms
90,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

tree = [set() for _ in range(N)]

for i in range(N-1):
    a, b = map(lambda x: int(x) - 1, input().split())
    tree[a].add(b)
    tree[b].add(a)

for i in range(N):
    sum = 0
    for next in tree[i]:
        sum += len(tree[next]) - 1
    print(sum)
0