結果

問題 No.2427 Tree Distance Two
ユーザー tassei903tassei903
提出日時 2023-08-15 04:47:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 789 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 125,028 KB
最終ジャッジ日時 2024-05-02 16:57:54
合計ジャッジ時間 16,319 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 41 ms
51,712 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 787 ms
112,128 KB
testcase_04 AC 41 ms
51,968 KB
testcase_05 AC 789 ms
112,384 KB
testcase_06 AC 41 ms
51,840 KB
testcase_07 AC 570 ms
125,028 KB
testcase_08 AC 640 ms
123,648 KB
testcase_09 AC 603 ms
123,520 KB
testcase_10 AC 642 ms
124,928 KB
testcase_11 AC 619 ms
123,012 KB
testcase_12 AC 678 ms
120,764 KB
testcase_13 AC 719 ms
117,760 KB
testcase_14 AC 333 ms
109,824 KB
testcase_15 AC 42 ms
51,968 KB
testcase_16 AC 43 ms
52,608 KB
testcase_17 AC 42 ms
51,968 KB
testcase_18 AC 42 ms
52,352 KB
testcase_19 AC 42 ms
52,224 KB
testcase_20 AC 106 ms
77,312 KB
testcase_21 AC 109 ms
77,696 KB
testcase_22 AC 93 ms
74,752 KB
testcase_23 AC 93 ms
74,496 KB
testcase_24 AC 110 ms
77,312 KB
testcase_25 AC 230 ms
85,504 KB
testcase_26 AC 493 ms
98,432 KB
testcase_27 AC 355 ms
92,544 KB
testcase_28 AC 721 ms
108,928 KB
testcase_29 AC 647 ms
105,344 KB
testcase_30 AC 462 ms
97,664 KB
testcase_31 AC 315 ms
90,240 KB
testcase_32 AC 480 ms
97,536 KB
testcase_33 AC 425 ms
94,976 KB
testcase_34 AC 173 ms
82,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
g = [[] for i in range(n)]
for _ in range(n-1):
    u, v = map(int,input().split())
    u-=1
    v-=1
    g[u].append(v)
    g[v].append(u)

for i in range(n):
    r = 0
    for j in g[i]:
        r += len(g[j]) - 1
    print(r)
0