A warehouse operator is tracking the battery charge of every delivery robot on the floor and has exactly one spare top-up amount that could be applied to a single robot's battery. For each robot, considered independently of the others, decide whether giving that one robot the top-up would let its charge reach at least as high as the most-charged robot currently on the floor. Ties count as reaching the front — the robot does not need to strictly exceed everyone else, only match the current maximum.
The first line contains two space-separated integers n and top_up. The second line contains n space-separated integers, the current charge level of each robot in order.
Print n space-separated tokens on a single line, each either true or false, where the i-th token answers the question for the i-th robot in the input order.
1 <= n <= 2000000 <= charge_i <= 10^9 for every robot0 <= top_up <= 10^9Example 1
Input
5 2 3 1 4 1 5
Expected
true false true false true
Explanation
The maximum charge among all robots is 5. Robot 1: 3+2=5 >= 5, true. Robot 2: 1+2=3 >= 5 is false. Robot 3: 4+2=6 >= 5, true. Robot 4: 1+2=3 >= 5 is false. Robot 5: 5+2=7 >= 5, true. Output: true false true false true.
Example 2
Input
3 0 7 7 7
Expected
true true true
Explanation
The maximum charge is 7, and top_up is 0. Every robot already has charge 7, so 7+0=7 >= 7 holds for all three (a tie still counts). Output: true true true.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →