結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
Ueki
|
| 提出日時 | 2019-03-22 22:54:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 300 ms / 2,000 ms |
| コード長 | 323 bytes |
| コンパイル時間 | 78 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 27,392 KB |
| 最終ジャッジ日時 | 2024-09-19 06:21:18 |
| 合計ジャッジ時間 | 4,489 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
# 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)
Ueki