| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 23 | 19 | 14 | 82.353% |
The cows want to form an expeditionary team to explore the wooded area at the edge of Farmer John's territory. Exploring turns out to be an activity that requires more skill than just standing in the pasture and grazing.
The team of C (1 ≤ C ≤ 20) cows numbered 1..C must include cows that are able to navigate through the woods without getting lost, fend off big nasty creatures, tell jokes to keep the morale high, etc. At least one cow on the team must possess each of these A (1 ≤ A ≤ 20) special abilities numbered 1..A. Some cows have only one ability, but many have multiple abilities; some cows are just freeloaders who are completely useless.
Given a list of all the cows and the abilities of each cow, compute the number of different exploration teams that the cows can form, such that the team as a whole has all the given abilities.
4 2 2 3 1 1 2
6
The possible exploration teams are: {1, 2}, {2, 3}, {1, 2, 3}, {1, 2, 4}, {2, 3, 4}, and {1, 2, 3, 4}.