結果

問題 No.806 木を道に
ユーザー Mopepe51Mopepe51
提出日時 2019-03-22 21:44:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 233 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 11,764 KB
実行使用メモリ 44,404 KB
最終ジャッジ日時 2023-10-19 07:44:57
合計ジャッジ時間 12,985 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,892 KB
testcase_01 AC 29 ms
9,892 KB
testcase_02 AC 30 ms
9,900 KB
testcase_03 AC 30 ms
9,896 KB
testcase_04 AC 30 ms
9,892 KB
testcase_05 AC 30 ms
9,908 KB
testcase_06 AC 30 ms
9,900 KB
testcase_07 AC 30 ms
9,892 KB
testcase_08 AC 30 ms
9,892 KB
testcase_09 AC 30 ms
9,892 KB
testcase_10 AC 131 ms
17,832 KB
testcase_11 AC 118 ms
16,072 KB
testcase_12 AC 492 ms
37,360 KB
testcase_13 AC 351 ms
30,440 KB
testcase_14 AC 455 ms
36,268 KB
testcase_15 AC 488 ms
37,852 KB
testcase_16 AC 174 ms
20,096 KB
testcase_17 AC 423 ms
34,244 KB
testcase_18 AC 64 ms
12,580 KB
testcase_19 AC 138 ms
18,056 KB
testcase_20 AC 424 ms
34,252 KB
testcase_21 AC 230 ms
23,316 KB
testcase_22 AC 616 ms
44,400 KB
testcase_23 AC 608 ms
44,404 KB
testcase_24 AC 248 ms
27,616 KB
testcase_25 AC 357 ms
35,596 KB
testcase_26 TLE -
testcase_27 TLE -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
edges=[list(map(int,input().split())) for _ in range(N-1)]
f={}
for a,b in edges:
    f[a]=f.get(a,[])+[b]
    f[b]=f.get(b,[])+[a]
g=sorted([len(v) for v in f.values()])
r=0
for v in g[2:]:
    if v>2:r+=v-2
print(r)
0