結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,916 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 14 ms
7,912 KB
testcase_03 AC 15 ms
7,920 KB
testcase_04 AC 15 ms
7,856 KB
testcase_05 AC 14 ms
7,912 KB
testcase_06 AC 15 ms
7,848 KB
testcase_07 AC 13 ms
7,960 KB
testcase_08 AC 14 ms
7,812 KB
testcase_09 AC 14 ms
7,960 KB
testcase_10 AC 90 ms
11,776 KB
testcase_11 AC 83 ms
11,120 KB
testcase_12 AC 326 ms
22,232 KB
testcase_13 AC 229 ms
18,308 KB
testcase_14 AC 300 ms
21,404 KB
testcase_15 AC 329 ms
22,328 KB
testcase_16 AC 120 ms
13,228 KB
testcase_17 AC 294 ms
20,624 KB
testcase_18 AC 41 ms
9,404 KB
testcase_19 AC 96 ms
11,712 KB
testcase_20 AC 282 ms
20,616 KB
testcase_21 AC 160 ms
14,944 KB
testcase_22 AC 375 ms
24,576 KB
testcase_23 AC 402 ms
24,660 KB
testcase_24 AC 183 ms
16,864 KB
testcase_25 AC 278 ms
21,472 KB
testcase_26 AC 119 ms
13,348 KB
testcase_27 AC 335 ms
24,924 KB
testcase_28 AC 22 ms
8,224 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