結果

問題 No.2427 Tree Distance Two
ユーザー minimumminimum
提出日時 2023-08-18 21:36:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 805 ms / 2,000 ms
コード長 277 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 125,056 KB
最終ジャッジ日時 2024-05-06 03:32:10
合計ジャッジ時間 14,960 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 42 ms
51,584 KB
testcase_02 AC 41 ms
52,096 KB
testcase_03 AC 805 ms
112,128 KB
testcase_04 AC 42 ms
51,584 KB
testcase_05 AC 797 ms
111,872 KB
testcase_06 AC 44 ms
51,584 KB
testcase_07 AC 588 ms
123,964 KB
testcase_08 AC 657 ms
123,776 KB
testcase_09 AC 611 ms
123,392 KB
testcase_10 AC 634 ms
125,056 KB
testcase_11 AC 661 ms
122,544 KB
testcase_12 AC 714 ms
120,404 KB
testcase_13 AC 749 ms
117,464 KB
testcase_14 AC 338 ms
110,464 KB
testcase_15 AC 43 ms
51,712 KB
testcase_16 AC 44 ms
52,224 KB
testcase_17 AC 42 ms
51,840 KB
testcase_18 AC 44 ms
52,352 KB
testcase_19 AC 43 ms
51,840 KB
testcase_20 AC 109 ms
76,928 KB
testcase_21 AC 113 ms
77,312 KB
testcase_22 AC 101 ms
76,928 KB
testcase_23 AC 100 ms
76,288 KB
testcase_24 AC 113 ms
77,312 KB
testcase_25 AC 236 ms
85,760 KB
testcase_26 AC 500 ms
97,920 KB
testcase_27 AC 377 ms
91,904 KB
testcase_28 AC 760 ms
109,440 KB
testcase_29 AC 660 ms
105,472 KB
testcase_30 AC 493 ms
97,536 KB
testcase_31 AC 331 ms
89,984 KB
testcase_32 AC 508 ms
97,408 KB
testcase_33 AC 434 ms
94,720 KB
testcase_34 AC 181 ms
82,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N - 1):
    u, v = map(lambda x: x - 1, map(int, input().split()))
    edges[u].append(v)
    edges[v].append(u)
for u in range(N):
    ans = 0
    for v in edges[u]:
        ans += len(edges[v]) - 1
    print(ans)
0