Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Delete the Array

Limits 1s, 512 MB

There is an array of size n. You will be given an integer x. In each move you have to subtract x or the minimum element of the array from all other elements of the array (Including the minimum element). If any element of the array becomes 0 or negative after each move then you will have to remove the number from the array.

You will have to delete all elements from the array with minimum number of moves.


The first line will consist of two integers n (1 ≤ n ≤ 1000) and x (0 ≤ x ≤ 100000). The second line will consist of n integer a1, a2, a3, ... an (0 ≤ ai ≤ 100000).


Output in a single line the minimum number of moves required.


5 4
8 1 2 7 5



66% Solution Ratio

fsshakkhorEarliest, Apr '19

saquib2508Fastest, 0.0s

fsshakkhorLightest, 131 kB

touhidurShortest, 167B


Login to submit