Problem 828
Kids With the Greatest Number of Candies
Easy · 10 pts · Array
Problem
Kid i has CANDIES[i] candies, and you have EXTRA more candies to give away. For each kid separately, decide whether giving them all EXTRA candies would make their total at least as large as every other kid's current amount (ties count as greatest). Find the current maximum once, then each kid qualifies when CANDIES[i] + EXTRA >= maximum.
Input
The first line contains N and EXTRA. The second line contains the N candy counts.
Output
Print N words separated by spaces: YES or NO for each kid.
Constraints
2 <= N <= 100; 1 <= CANDIES[i] <= 100; 1 <= EXTRA <= 50
Example input
5 3 2 3 5 1 3
Example output
YES YES YES NO YES
Explanation
With candies 2 3 5 1 3 and EXTRA = 3, the maximum is 5. Kids with 2, 3, 5 and 3 reach at least 5 (5, 6, 8, 6), but the kid with 1 reaches only 4. So the answer is YES YES YES NO YES.