AdvancedRating 1800
Split Into Equal-Sum Groups
Can the numbers be split into k groups with equal sums (every number used exactly once)? Print YES or NO.
Input
n (≤ 16) and k, then n positive integers.
Output
YES or NO.
Sample 1
Input
7 4 4 3 2 3 5 2 1
Output
YES
Sample 2
Input
4 3 1 2 3 4
Output
NO
Output appears here