結果
| 問題 | No.1582 Vertexes vs Edges | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-07-16 09:25:46 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 475 bytes | 
| コンパイル時間 | 84 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 28,416 KB | 
| 最終ジャッジ日時 | 2024-09-17 12:39:08 | 
| 合計ジャッジ時間 | 7,729 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 3 WA * 33 | 
ソースコード
import sys
from collections import deque
input = sys.stdin.buffer.readline
N = int(input())
T = [[] for _ in range(N)]
for _ in range(N - 1):
    a, b = (int(x) - 1 for x in input().split())
    T[a].append(b)
    T[b].append(a)
d = deque([0])
color = [None] * N
color[0] = False
while d:
    v = d.pop()
    c = not color[v]
    for x in T[v]:
        if color[x] is None:
            d.append(x)
            color[x] = c
print(min(color.count(True), color.count(False)))
            
            
            
        