Z55
Magnetic Force Between Two Balls
Problem Statement & Objective
In an array of basket positions, distribute m balls such that the minimum magnetic force between any two balls is maximized.
Function Signature (Python)
max_distance_balls(positions: list[int], m: int) -> intInput & Output Contract
Output Rule:Maksimum minimum mesafe tam sayısı.
System Constraints
2 <= konumlar.length <= 10^5
1 <= konumlar[i] <= 10^9
Tüm konumlar benzersizdir
2 <= m <= konumlar.lengthExample Execution Walkthrough
konumlar = [1, 2, 3, 4, 7], m = 3
1, 4 ve 7 konumlarına koyulursa min mesafe 3 olur -> cevap: 3Example Test Scenarios (3)
Example 1
Input:
[[1,2,3,4,7],3]Expected Output:
3Example 2: Uçlar
Input:
[[5,4,3,2,1,1000000000],2]Expected Output:
999999999Example 3: İki Top
Input:
[[1,10],2]Expected Output:
9