#K60152. Group Formation Challenge
Group Formation Challenge
Group Formation Challenge
You are given a total of n participants and a target number k representing exactly how many groups you need to form. Each group must be non-empty. The names of the participants are provided for reference, but they do not affect the outcome since the problem only depends on the numbers.
You are to determine whether it is possible to create exactly k groups from the n participants. The necessary and sufficient condition is:
$$ k \le n $$If this condition holds, then the answer is "YES"; otherwise, it is "NO".
inputFormat
The input is given via standard input (stdin) and consists of two parts:
- The first line contains two integers,
n
andk
, wheren
is the number of participants andk
is the number of groups to form. - The second line contains
n
space-separated strings representing the names of each participant.
outputFormat
Output a single line to standard output (stdout) containing either "YES" if it is possible to form exactly k
groups from the n
participants, or "NO" otherwise.
6 3
alice bob charlie dave eve frank
YES