关闭

UVA 11045 My T-shirt suits me(网络流)

1165人阅读 评论(0) 收藏 举报
分类:


  My T-shirt suits me 

Our friend Victor participates as an instructor in an environmental volunteer program. His boss asked Victor to distribute N T-shirts to M volunteers, one T-shirt each volunteer, where N is multiple of six, and N$ \ge$M. There are the same number of T-shirts of each one of the six available sizes: XXL, XL, L, M , S, and XS. Victor has a little problem because only two sizes of the T-shirts suit each volunteer.


You must write a program to decide if Victor can distribute T-shirts in such a way that all volunteers get a T-shirt that suit them. If N $ \neq$ M, there can be some remaining T-shirts.

Input 

The first line of the input contains the number of test cases. For each test case, there is a line with two numbers N and MN is multiple of 6, 1$ \le$N$ \le$36, and indicates the number of T-shirts. Number M1$ \le$M$ \le$30, indicates the number of volunteers, with N$ \ge$M. Subsequently, M lines are listed where each line contains, separated by one space, the two sizes that suit each volunteer (XXL, XL, L, M , S, or XS).

Output