P3026 [USACO11OPEN] Learning Languages S

题目描述

Farmer John's N (2

输入格式

\* Line 1: Two space-separated integers: N and M \* Lines 2..N+1: Line i+1 describes the languages that cow i can speak with $(K_i)+1$ space-separated integers: $K_i$, $L_i1$, L\_i2,...,L\_i{K\_i}.

输出格式

\* Line 1: A single integer that is the minimum number of books that FJ must purchase. \* Lines 2..B+1: Line i+1 contains two space-separated integers: the language id # and the id # of the cow to receive book i. If multiple solutions exist, print any one.