結果

問題 No.806 木を道に
ユーザー irumo8202irumo8202
提出日時 2022-01-31 11:03:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 382 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 25,008 KB
最終ジャッジ日時 2023-09-02 02:07:13
合計ジャッジ時間 7,641 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,864 KB
testcase_01 AC 15 ms
7,860 KB
testcase_02 AC 16 ms
7,916 KB
testcase_03 AC 15 ms
7,916 KB
testcase_04 AC 14 ms
7,912 KB
testcase_05 AC 15 ms
7,856 KB
testcase_06 AC 14 ms
7,780 KB
testcase_07 AC 14 ms
7,784 KB
testcase_08 AC 14 ms
7,948 KB
testcase_09 AC 14 ms
7,820 KB
testcase_10 AC 95 ms
11,680 KB
testcase_11 AC 83 ms
11,248 KB
testcase_12 AC 321 ms
22,228 KB
testcase_13 AC 238 ms
18,172 KB
testcase_14 AC 310 ms
21,544 KB
testcase_15 AC 328 ms
22,280 KB
testcase_16 AC 124 ms
13,184 KB
testcase_17 AC 286 ms
20,480 KB
testcase_18 AC 42 ms
9,300 KB
testcase_19 AC 99 ms
11,680 KB
testcase_20 AC 291 ms
20,512 KB
testcase_21 AC 165 ms
15,000 KB
testcase_22 AC 382 ms
24,712 KB
testcase_23 AC 380 ms
24,784 KB
testcase_24 AC 190 ms
16,828 KB
testcase_25 AC 281 ms
21,504 KB
testcase_26 AC 115 ms
13,308 KB
testcase_27 AC 334 ms
25,008 KB
testcase_28 AC 23 ms
8,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

G = [[] for _ in range(N)]

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

print(sum(map(lambda x: max(0, len(x) - 2), G)))
0