#C11734. Arrange Team Meeting

    ID: 41083 Type: Default 1000ms 256MiB

Arrange Team Meeting

Arrange Team Meeting

In this problem, you are given a total of (n) team members and a set of constraints. Each constraint is a list of team member indices that must all attend or all be absent from the meeting. Your task is to determine whether it is possible to select exactly (m) team members so that, for every constraint, either all members in the constraint are selected or none of them are.

The input is given via standard input (stdin) and the output should be printed to standard output (stdout) as either 'True' or 'False'.

inputFormat

The first line of input contains three integers (n), (m), and (k), where:

  • \(n\) is the total number of team members (numbered from 0 to \(n-1\)).
  • \(m\) is the exact number of team members required for the meeting.
  • \(k\) is the number of constraints.
Then, \(k\) lines follow. Each of these lines starts with an integer \(r\) (the number of members in that constraint) followed by \(r\) space-separated integers representing the indices of the team members who must attend together.

outputFormat

Print a single line with either 'True' if it is possible to arrange the meeting with exactly (m) team members under the given constraints, or 'False' otherwise.## sample

5 3 3
2 0 1
2 1 3
2 2 4
True