U268899 [USACO10OPEN]Cows in Trees S

题目描述

Bessie the cow and Farmer John have gone traveling to the city of Mootreepolis, but they were separated and now Bessie is lost. Farmer John has organized a search party to find her. For better or worse, the only way they have to locate her is by the direction of Bessie's moo (which is loud enough as to be heard anywhere in the city). True to its name, Mootreepolis transportation is organized as a tree. In particular, the city has N (1

输入格式

PROBLEM NAME: cowtree INPUT FORMAT: * Line 1: A single integer: N * Lines 2..N+1: Line i+2 contains multiple space-separated integers that describe the neighbors of location i in Mootreepolis: K, N_0, ..., N_K-1 SAMPLE INPUT (file cowtree.in): 8 1 3 1 4 1 3 4 0 2 6 4 4 3 7 1 5 1 4 1 3 1 4 OUTPUT FORMAT: * Line none: write to standard out, not the output file. SAMPLE OUTPUT (file cowtree.out):

输出格式

说明/提示

In order to ensure that your program's output is not buffered inside your program; you must 'flush' your output. For C and C++ users, if you're using stdio.h, include the line setbuf(stdout, 0); near the top of your program. If you're using C++ iostream style I/O, flush each output line like this: cout