結果

問題 No.2427 Tree Distance Two
ユーザー fiblonariafiblonaria
提出日時 2023-08-24 13:27:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,074 ms / 2,000 ms
コード長 245 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 203,860 KB
最終ジャッジ日時 2023-08-24 13:28:12
合計ジャッジ時間 18,788 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,120 KB
testcase_01 AC 69 ms
71,384 KB
testcase_02 AC 71 ms
71,284 KB
testcase_03 AC 938 ms
162,452 KB
testcase_04 AC 68 ms
71,068 KB
testcase_05 AC 954 ms
162,844 KB
testcase_06 AC 71 ms
71,320 KB
testcase_07 AC 782 ms
201,684 KB
testcase_08 AC 1,074 ms
196,400 KB
testcase_09 AC 811 ms
198,552 KB
testcase_10 AC 839 ms
203,860 KB
testcase_11 AC 795 ms
197,764 KB
testcase_12 AC 861 ms
192,272 KB
testcase_13 AC 879 ms
182,440 KB
testcase_14 AC 467 ms
162,352 KB
testcase_15 AC 70 ms
71,344 KB
testcase_16 AC 71 ms
71,436 KB
testcase_17 AC 68 ms
71,264 KB
testcase_18 AC 71 ms
71,316 KB
testcase_19 AC 71 ms
71,248 KB
testcase_20 AC 126 ms
79,292 KB
testcase_21 AC 133 ms
79,360 KB
testcase_22 AC 119 ms
78,208 KB
testcase_23 AC 118 ms
78,100 KB
testcase_24 AC 128 ms
79,240 KB
testcase_25 AC 294 ms
99,968 KB
testcase_26 AC 599 ms
130,076 KB
testcase_27 AC 448 ms
115,916 KB
testcase_28 AC 882 ms
156,524 KB
testcase_29 AC 785 ms
147,312 KB
testcase_30 AC 598 ms
128,444 KB
testcase_31 AC 400 ms
110,968 KB
testcase_32 AC 587 ms
128,684 KB
testcase_33 AC 525 ms
122,392 KB
testcase_34 AC 217 ms
92,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
con = [set() for i in range(N)]
for i in range(N - 1):
	A = list(map(int, input().split()))
	for j in range(2):
		con[A[j] - 1].add(A[1 - j] - 1)
for i in range(N):
	ans = 0
	for j in con[i]:
		ans += len(con[j]) - 1
	print(ans)
0