結果

問題 No.806 木を道に
ユーザー UekiUeki
提出日時 2019-03-22 22:54:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 11,988 KB
実行使用メモリ 26,896 KB
最終ジャッジ日時 2023-10-19 10:09:50
合計ジャッジ時間 4,872 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,064 KB
testcase_01 AC 29 ms
10,064 KB
testcase_02 AC 30 ms
10,064 KB
testcase_03 AC 29 ms
10,064 KB
testcase_04 AC 29 ms
10,064 KB
testcase_05 AC 29 ms
10,068 KB
testcase_06 AC 29 ms
10,068 KB
testcase_07 AC 30 ms
10,064 KB
testcase_08 AC 31 ms
10,064 KB
testcase_09 AC 30 ms
10,064 KB
testcase_10 AC 85 ms
13,612 KB
testcase_11 AC 79 ms
13,276 KB
testcase_12 AC 262 ms
24,144 KB
testcase_13 AC 191 ms
20,140 KB
testcase_14 AC 246 ms
23,332 KB
testcase_15 AC 268 ms
24,236 KB
testcase_16 AC 110 ms
15,236 KB
testcase_17 AC 227 ms
22,416 KB
testcase_18 AC 49 ms
11,384 KB
testcase_19 AC 86 ms
13,804 KB
testcase_20 AC 229 ms
22,420 KB
testcase_21 AC 138 ms
16,908 KB
testcase_22 AC 310 ms
26,540 KB
testcase_23 AC 308 ms
26,540 KB
testcase_24 AC 143 ms
18,824 KB
testcase_25 AC 202 ms
23,312 KB
testcase_26 AC 96 ms
15,128 KB
testcase_27 AC 248 ms
26,896 KB
testcase_28 AC 36 ms
10,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
adj = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].append(b)
    adj[b].append(a)

ans = 0
for l in adj:
    ans += max(0, len(l)-2)
print(ans)
0