結果

問題 No.2427 Tree Distance Two
ユーザー ああいいああいい
提出日時 2023-08-18 23:22:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 619 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 127,744 KB
最終ジャッジ日時 2024-05-06 06:05:27
合計ジャッジ時間 12,532 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 38 ms
51,712 KB
testcase_03 AC 604 ms
114,780 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 619 ms
114,764 KB
testcase_06 AC 36 ms
51,968 KB
testcase_07 AC 509 ms
127,228 KB
testcase_08 AC 544 ms
126,580 KB
testcase_09 AC 503 ms
126,056 KB
testcase_10 AC 549 ms
127,744 KB
testcase_11 AC 540 ms
125,340 KB
testcase_12 AC 590 ms
122,848 KB
testcase_13 AC 580 ms
120,108 KB
testcase_14 AC 300 ms
113,152 KB
testcase_15 AC 36 ms
52,096 KB
testcase_16 AC 39 ms
52,096 KB
testcase_17 AC 39 ms
51,968 KB
testcase_18 AC 41 ms
52,736 KB
testcase_19 AC 40 ms
51,968 KB
testcase_20 AC 90 ms
77,408 KB
testcase_21 AC 92 ms
77,300 KB
testcase_22 AC 77 ms
74,956 KB
testcase_23 AC 77 ms
74,476 KB
testcase_24 AC 88 ms
77,200 KB
testcase_25 AC 184 ms
86,016 KB
testcase_26 AC 363 ms
99,968 KB
testcase_27 AC 316 ms
93,056 KB
testcase_28 AC 544 ms
110,976 KB
testcase_29 AC 461 ms
107,136 KB
testcase_30 AC 361 ms
98,816 KB
testcase_31 AC 236 ms
91,008 KB
testcase_32 AC 359 ms
98,664 KB
testcase_33 AC 345 ms
96,128 KB
testcase_34 AC 142 ms
82,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
G = [[] for _ in range(N)]
Gnum = [0] * N

for _ in range(N - 1):
	u,v = map(int,input().split())
	u -= 1
	v -= 1
	Gnum[u] += 1
	Gnum[v] += 1
	G[u].append(v)
	G[v].append(u)
	
for i in range(N):
	ans = 0
	for u in G[i]:
		ans += Gnum[u] - 1
	print(ans)
0