結果
問題 |
No.806 木を道に
|
ユーザー |
![]() |
提出日時 | 2021-08-14 11:50:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 197 ms / 2,000 ms |
コード長 | 258 bytes |
コンパイル時間 | 143 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-10-05 02:14:22 |
合計ジャッジ時間 | 3,710 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N = int(input()) deg = [0] * N for _ in range(N-1): a, b = map(int, input().split()) deg[a-1] += 1 deg[b-1] += 1 ans = 0 for d in deg: ans += max(0, d-2) print(ans)