結果

問題 No.2427 Tree Distance Two
ユーザー ramdosramdos
提出日時 2023-08-17 21:02:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 252 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 82,840 KB
最終ジャッジ日時 2024-05-05 03:53:22
合計ジャッジ時間 11,876 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,128 KB
testcase_01 AC 35 ms
10,880 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 TLE -
testcase_04 AC 30 ms
10,752 KB
testcase_05 TLE -
testcase_06 AC 29 ms
10,880 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
V=[[] for i in range(N+1)]
for i in range(N-1):
    a,b=map(int,input().split())
    V[a].append(b)
    V[b].append(a)
for i in range(1,N+1):
    a=set()
    c=[V[x] for x in V[i]]
    for x in c:
        a=a.union(x)
    print(len(a)-1)
0