Submit | All submissions | Best solutions | Back to list |
ADOMINO - Arranging Dominoes |
Dominoes have long entertained both game enthusiasts and programmers for quite some time. Many games can be played with dominoes, including multiplayer and single player games. Hari Khan has come up with a single player game. He takes N boxes and arranges them in a row at positions N1, N2 ... NN. Now he has to place D dominoes (D <= N) in the boxes such that the minimum distance between any two filled boxes is maximized.
Input
The first line of the input contains an integer t, the number of test cases. t test cases follow.
The first line of each test case consists of two integers, N <= 100000 and D <= N, separated by a single space.
N lines follow, each containing a single integer Ni <= 1000000000, indicating the location of the ith box.
Output
For each test case, output a single line containing a single integer denoting the largest minimum distance achievable between any two boxes with dominoes.
Example
Input: 1 5 3 1 2 3 4 5 Output: 2
Added by: | Matthew Reeder |
Date: | 2006-10-29 |
Time limit: | 1s |
Source limit: | 30000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | Al-Khawarizm 2006 |
hide comments
2015-04-15 12:25:38 CoNtRaDiCtIoN
remember two boxes can be at same position !! |
|
2011-01-24 10:11:09 YatsukoYin
? <= t <= ? |
|
2009-12-30 12:24:15 (^^,)
Same Problems: AGGRCOW |