#P16272. [蓝桥杯 2026 省 Java B 组] 星座导航校准器
[蓝桥杯 2026 省 Java B 组] 星座导航校准器
Problem Description
When a deep-space probe performs missions, it needs to rely on a constellation navigation system for accurate positioning. The system consists of several navigation satellites. Each satellite has a fixed orbital position and a signal strength.
To ensure navigation accuracy, you need to choose a set of satellites to form a “navigation constellation”, such that:
- If two satellites are too close, they will interfere with each other and reduce navigation accuracy.
- The constellation must remain connected (with communication radius , any two satellites can reach each other via direct or indirect communication).
- After considering the above factors, maximize the total navigation accuracy.
Navigation Accuracy Rules
Suppose the selected navigation constellation contains the satellite set . Each satellite is located at coordinates and has signal strength .
- Base precision: each satellite contributes base precision equal to its signal strength .
- Geometric bonus: considering the geometric distribution of the constellation, compute the geometric bonus over all satellite pairs:
where is the Euclidean distance between satellites and .
Connectivity constraint:
- If the distance between two satellites satisfies , then they can communicate directly.
- The entire constellation must stay connected (any two satellites can reach each other through direct or indirect communication).
Interference penalty:
If two satellites are too close (), signal interference occurs and the precision decreases:
$$\begin{aligned} \text{InterferencePenalty} = \sum_{i=1}^{k-1} \sum_{j=i+1}^{k} \mathbf{1}_{d_{ij} < T} \cdot (T - d_{ij}) \times \min(p_i, p_j) \end{aligned}$$where is the indicator function, which equals when the condition holds and otherwise. For each distinct satellite pair (), the interference penalty is counted once.
Total navigation precision formula:
$$\begin{aligned} \text{TotalPrecision} = \sum_{i=1}^{k} p_i + \text{GeometricBonus} - \text{InterferencePenalty} \end{aligned}$$Given the coordinates and signal strengths of candidate satellites, as well as the communication radius and interference threshold , select some satellites to form a navigation constellation such that:
- The constellation remains connected (communication radius ).
- The total navigation precision is maximized.
- The constellation contains at least satellites.
Input Format
The first line contains four integers , , , , representing the number of candidate satellites, the minimum number of satellites, the communication radius, and the interference threshold.
The next lines each contain three integers , , , representing the coordinates and signal strength of the -th satellite.
Output Format
Output one line containing one integer, representing the maximum navigation precision that can be achieved (rounded down).
3 2 10 3
0 0 5
5 0 8
0 5 6
39
5 3 5 3
0 0 10
2 0 8
4 0 6
10 0 12
1 4 9
139
Hint
Sample Explanation 1
Optimal solution: choose satellites (indices start from ), i.e. the three satellites at , , and .
Connectivity check:
- $d_{12} = \sqrt{(0 - 5)^2 + (0 - 0)^2} = 5 \leq R = 10$ ✓
- $d_{13} = \sqrt{(0 - 0)^2 + (0 - 5)^2} = 5 \leq R = 10$ ✓
- $d_{23} = \sqrt{(5 - 0)^2 + (0 - 5)^2} = \sqrt{50} \approx 7.07 \leq R = 10$ ✓
All satellite pairs can communicate directly, so the constellation is connected.
Precision calculation:
-
Base precision: .
-
Geometric bonus:
- Satellites 1-2: $\frac{5 \times 8}{\sqrt{5^2 + 1}} = \frac{40}{\sqrt{26}} \approx 7.84$.
- Satellites 1-3: $\frac{5 \times 6}{\sqrt{5^2 + 1}} = \frac{30}{\sqrt{26}} \approx 5.88$.
- Satellites 2-3: $\frac{8 \times 6}{\sqrt{50 + 1}} = \frac{48}{\sqrt{51}} \approx 6.72$.
Total geometric bonus: .
-
Interference penalty: all distances are , so there is no interference penalty.
Total precision: , rounded down to 39.
Sample Explanation 2
Optimal solution: choose satellites (indices start from ), i.e. the four satellites at , , , and .
Connectivity check:
- ✓
- ✓
- $d_{15} = \sqrt{1^2 + 4^2} = \sqrt{17} \approx 4.12 \leq R = 5$ ✓
- ✓
- $d_{25} = \sqrt{1^2 + 4^2} = \sqrt{17} \approx 4.12 \leq R = 5$ ✓
- ✓
All selected satellite pairs can communicate directly, so the constellation is connected.
Precision calculation:
-
Base precision: .
-
Geometric bonus:
- Satellites 1-2: $\frac{10 \times 8}{\sqrt{2^2 + 1}} = \frac{80}{\sqrt{5}} \approx 35.78$.
- Satellites 1-3: $\frac{10 \times 6}{\sqrt{4^2 + 1}} = \frac{60}{\sqrt{17}} \approx 14.55$.
- Satellites 1-5: $\frac{10 \times 9}{\sqrt{17 + 1}} = \frac{90}{\sqrt{18}} \approx 21.21$.
- Satellites 2-3: $\frac{8 \times 6}{\sqrt{2^2 + 1}} = \frac{48}{\sqrt{5}} \approx 21.47$.
- Satellites 2-5: $\frac{8 \times 9}{\sqrt{17 + 1}} = \frac{72}{\sqrt{18}} \approx 16.97$.
- Satellites 3-5: $\frac{6 \times 9}{\sqrt{5^2 + 1}} = \frac{54}{\sqrt{26}} \approx 10.59$.
Total geometric bonus: $35.78 + 14.55 + 21.21 + 21.47 + 16.97 + 10.59 = 120.57$.
3. Interference penalty:
- Satellites 1-2 have distance , causing interference: .
- Satellites 2-3 have distance , causing interference: .
- All other satellite pairs have distance , so there is no interference.
Total interference penalty: .
Total precision: , rounded down to 139.
Constraints and Notes for Test Cases
For of the testdata: , .
For of the testdata: , .
For all test cases:
- , , , .
- Coordinate range: .
- Signal strength: .
- It is guaranteed that there exists a solution with at least satellites that satisfies the connectivity constraint.
Translated by ChatGPT 5