結果

問題 No.806 木を道に
ユーザー UekiUeki
提出日時 2019-03-22 22:54:18
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 311 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,008 KB
実行使用メモリ 26,820 KB
最終ジャッジ日時 2023-10-19 10:09:45
合計ジャッジ時間 5,077 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,988 KB
testcase_01 AC 30 ms
9,988 KB
testcase_02 AC 30 ms
9,988 KB
testcase_03 AC 30 ms
9,988 KB
testcase_04 AC 30 ms
9,988 KB
testcase_05 AC 29 ms
9,992 KB
testcase_06 AC 29 ms
9,992 KB
testcase_07 AC 34 ms
9,988 KB
testcase_08 AC 29 ms
9,988 KB
testcase_09 AC 30 ms
9,988 KB
testcase_10 AC 82 ms
13,536 KB
testcase_11 AC 77 ms
13,200 KB
testcase_12 AC 262 ms
24,068 KB
testcase_13 AC 193 ms
20,064 KB
testcase_14 AC 254 ms
23,256 KB
testcase_15 AC 270 ms
24,160 KB
testcase_16 AC 107 ms
15,160 KB
testcase_17 AC 229 ms
22,340 KB
testcase_18 AC 49 ms
11,308 KB
testcase_19 AC 86 ms
13,728 KB
testcase_20 AC 231 ms
22,344 KB
testcase_21 AC 137 ms
16,832 KB
testcase_22 AC 309 ms
26,464 KB
testcase_23 AC 311 ms
26,464 KB
testcase_24 AC 145 ms
18,748 KB
testcase_25 AC 203 ms
23,236 KB
testcase_26 AC 99 ms
15,052 KB
testcase_27 AC 258 ms
26,820 KB
testcase_28 AC 36 ms
10,388 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