結果

問題 No.2427 Tree Distance Two
ユーザー chineristACchineristAC
提出日時 2023-08-18 21:45:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 576 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 122,400 KB
最終ジャッジ日時 2024-05-06 03:44:09
合計ジャッジ時間 10,822 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 36 ms
52,352 KB
testcase_02 AC 37 ms
52,352 KB
testcase_03 AC 545 ms
111,360 KB
testcase_04 AC 38 ms
52,224 KB
testcase_05 AC 576 ms
111,592 KB
testcase_06 AC 36 ms
52,096 KB
testcase_07 AC 425 ms
122,400 KB
testcase_08 AC 475 ms
121,556 KB
testcase_09 AC 464 ms
121,264 KB
testcase_10 AC 448 ms
121,600 KB
testcase_11 AC 446 ms
120,896 KB
testcase_12 AC 503 ms
118,152 KB
testcase_13 AC 508 ms
115,972 KB
testcase_14 AC 214 ms
109,396 KB
testcase_15 AC 36 ms
52,352 KB
testcase_16 AC 38 ms
52,352 KB
testcase_17 AC 36 ms
52,352 KB
testcase_18 AC 37 ms
52,608 KB
testcase_19 AC 37 ms
52,224 KB
testcase_20 AC 66 ms
74,268 KB
testcase_21 AC 75 ms
77,184 KB
testcase_22 AC 60 ms
68,608 KB
testcase_23 AC 62 ms
67,968 KB
testcase_24 AC 74 ms
76,928 KB
testcase_25 AC 138 ms
85,376 KB
testcase_26 AC 309 ms
98,344 KB
testcase_27 AC 220 ms
91,900 KB
testcase_28 AC 493 ms
109,304 KB
testcase_29 AC 435 ms
105,216 KB
testcase_30 AC 302 ms
97,280 KB
testcase_31 AC 208 ms
89,996 KB
testcase_32 AC 301 ms
96,896 KB
testcase_33 AC 274 ms
94,716 KB
testcase_34 AC 114 ms
82,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations
import heapq

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
edge = [[] for v in range(N)]
for _ in range(N-1):
    u,v = mi()
    edge[u-1].append(v-1)
    edge[v-1].append(u-1)

for v in range(N):
    res = 0
    for nv in edge[v]:
        res += len(edge[nv]) - 1
    print(res)

0