結果

問題 No.2427 Tree Distance Two
ユーザー ryohei22ryohei22
提出日時 2023-08-18 21:32:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 824 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 82,076 KB
実行使用メモリ 126,944 KB
最終ジャッジ日時 2024-05-06 03:26:15
合計ジャッジ時間 14,965 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,968 KB
testcase_01 AC 36 ms
52,224 KB
testcase_02 AC 35 ms
51,712 KB
testcase_03 AC 824 ms
116,168 KB
testcase_04 AC 35 ms
52,224 KB
testcase_05 AC 777 ms
116,476 KB
testcase_06 AC 35 ms
52,096 KB
testcase_07 AC 600 ms
126,944 KB
testcase_08 AC 641 ms
126,080 KB
testcase_09 AC 582 ms
124,544 KB
testcase_10 AC 604 ms
126,808 KB
testcase_11 AC 610 ms
125,512 KB
testcase_12 AC 672 ms
122,908 KB
testcase_13 AC 725 ms
118,900 KB
testcase_14 AC 350 ms
114,048 KB
testcase_15 AC 36 ms
52,608 KB
testcase_16 AC 37 ms
52,864 KB
testcase_17 AC 36 ms
52,352 KB
testcase_18 AC 38 ms
52,608 KB
testcase_19 AC 37 ms
52,096 KB
testcase_20 AC 103 ms
77,292 KB
testcase_21 AC 103 ms
77,704 KB
testcase_22 AC 92 ms
76,928 KB
testcase_23 AC 88 ms
76,404 KB
testcase_24 AC 102 ms
77,004 KB
testcase_25 AC 222 ms
86,468 KB
testcase_26 AC 475 ms
100,212 KB
testcase_27 AC 332 ms
93,756 KB
testcase_28 AC 760 ms
113,104 KB
testcase_29 AC 660 ms
108,288 KB
testcase_30 AC 460 ms
100,108 KB
testcase_31 AC 312 ms
91,904 KB
testcase_32 AC 503 ms
99,412 KB
testcase_33 AC 415 ms
96,768 KB
testcase_34 AC 173 ms
83,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
e = [[] for _ in range(N)]
for _ in range(N-1):
    u, v = map(lambda x: int(x) - 1, input().split())
    e[u].append(v)
    e[v].append(u)

for v in range(N):
    q = e[v]
    cnt = sum([len(e[i]) - 1 for i in q])
    print(cnt)
0