結果

問題 No.2427 Tree Distance Two
ユーザー ntudantuda
提出日時 2023-08-19 09:46:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 759 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 154,180 KB
最終ジャッジ日時 2023-08-19 09:46:28
合計ジャッジ時間 16,557 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,320 KB
testcase_01 AC 73 ms
71,484 KB
testcase_02 AC 73 ms
71,132 KB
testcase_03 AC 759 ms
143,644 KB
testcase_04 AC 73 ms
71,488 KB
testcase_05 AC 750 ms
143,716 KB
testcase_06 AC 71 ms
71,320 KB
testcase_07 AC 583 ms
153,640 KB
testcase_08 AC 669 ms
147,028 KB
testcase_09 AC 623 ms
154,180 KB
testcase_10 AC 650 ms
147,572 KB
testcase_11 AC 637 ms
152,440 KB
testcase_12 AC 677 ms
153,444 KB
testcase_13 AC 699 ms
149,960 KB
testcase_14 AC 427 ms
142,300 KB
testcase_15 AC 73 ms
71,568 KB
testcase_16 AC 72 ms
71,524 KB
testcase_17 AC 72 ms
71,516 KB
testcase_18 AC 75 ms
71,392 KB
testcase_19 AC 73 ms
71,184 KB
testcase_20 AC 128 ms
78,268 KB
testcase_21 AC 133 ms
78,280 KB
testcase_22 AC 118 ms
78,512 KB
testcase_23 AC 119 ms
78,100 KB
testcase_24 AC 130 ms
78,224 KB
testcase_25 AC 237 ms
95,084 KB
testcase_26 AC 470 ms
118,708 KB
testcase_27 AC 359 ms
107,072 KB
testcase_28 AC 695 ms
138,676 KB
testcase_29 AC 638 ms
131,188 KB
testcase_30 AC 460 ms
117,372 KB
testcase_31 AC 312 ms
103,060 KB
testcase_32 AC 464 ms
116,984 KB
testcase_33 AC 406 ms
112,532 KB
testcase_34 AC 196 ms
88,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
UV = [list(map(int,input().split())) for _ in range(N-1)]
E = [[] for _ in range(N)]
for u,v in UV:
    u -= 1
    v -= 1
    E[u].append(v)
    E[v].append(u)
for i in range(N):
    ans = 0
    for j in E[i]:
        ans += len(E[j]) - 1
    print(ans)
0