#P15241. [NHSPC 2025] 資料中心

[NHSPC 2025] 資料中心

Problem Description

HyperNet, the world’s largest cloud infrastructure provider, is building the next generation of distributed data centers. The company has deployed nn cloud hosts around the world, numbered 1,2,…,n1, 2, \ldots, n. The hosts are interconnected by mm fiber links K={K1,K2,…,Km}K = \{K_1, K_2, \ldots, K_m\}. Each fiber link Ki=(ui,vi)K_i = (u_i, v_i) connects two different hosts (1≤ui,vi≤n,ui≠vi)(1 \leq u_i, v_i \leq n, u_i \neq v_i), and has a positive integer maintenance cost wiw_i. This huge distributed network will support global data exchange, AI model training, and real-time services in the future.

However, to deal with energy shortages and increasingly serious cyberattacks, HyperNet decides to use a dynamic connectivity strategy. That is, each fiber link KiK_i can only be turned on during a specific time interval [li,ri),0≤li<ri≤d[l_i, r_i), 0 \leq l_i < r_i \leq d (but it does not have to be turned on), in order to reduce energy usage and the attack surface. As a result, the network topology is no longer fixed at different times, and it may even split into multiple isolated segments.

To ensure that all hosts can communicate with each other, the data center security control center needs, at every time point ii satisfying 0≤i<d0 \leq i < d, to automatically decide which fiber links K′′⊆K′K'' \subseteq K' to turn on from the set of links that can be turned on K′⊆KK' \subseteq K, so that all hosts can communicate with each other and the total maintenance cost of the turned-on links is minimized.

For example, suppose there are 55 hosts (s1,s2,s3,s4,s5)(s_1, s_2, s_3, s_4, s_5) and 55 fiber links (K1,K2,K3,K4,K5)(K_1, K_2, K_3, K_4, K_5). The endpoints, maintenance costs, and available time intervals are as follows:

  • K1=(s1,s2),w1=5K_1 = (s_1, s_2), w_1=5, and it can be turned on during [0,4)[0, 4).
  • K2=(s2,s3),w2=1K_2 = (s_2, s_3), w_2=1, and it can be turned on during [0,4)[0, 4).
  • K3=(s4,s5),w3=3K_3 = (s_4, s_5), w_3=3, and it can be turned on during [2,6)[2, 6).
  • K4=(s5,s1),w4=1K_4 = (s_5, s_1), w_4=1, and it can be turned on during [1,5)[1, 5).
  • K5=(s2,s5),w5=2K_5 = (s_2, s_5), w_5=2, and it can be turned on during [3,6)[3, 6).

Then:

  • At time point 00, the links that can be turned on are K1,K2K_1, K_2. Even if all of them are turned on, s4,s5s_4, s_5 still cannot be connected, so it is impossible to make all hosts connected at time point 00.
  • At time point 22, the links that can be turned on are K1,K2,K3,K4K_1, K_2, K_3, K_4. Turning on all of them connects all 55 hosts, with total maintenance cost 5+1+3+1=105+1+3+1=10.
  • At time point 33, the links that can be turned on are K1,K2,K3,K4,K5K_1, K_2, K_3, K_4, K_5. If we turn on K2,K3,K4,K5K_2, K_3, K_4, K_5, the maintenance cost is 1+3+1+2=71+3+1+2=7; any other combination of links has a maintenance cost greater than 77.
  • At all other times, it is impossible to connect all hosts.

Input Format

$$\begin{aligned} &n \; m \; d \\ &u_1 \; v_1 \; w_1 \; l_1 \; r_1 \\ &u_2 \; v_2 \; w_2 \; l_2 \; r_2 \\ &\vdots \\ &u_m \; v_m \; w_m \; l_m \; r_m \end{aligned}$$
  • nn is the number of nodes.
  • mm is the number of edges.
  • dd is the upper bound of time points.
  • ui,vi,wi,li,riu_i, v_i, w_i, l_i, r_i mean that there is a fiber link connecting host uiu_i and host viv_i with maintenance cost wiw_i, and it can be turned on during the interval [li,ri)[l_i, r_i).

Output Format

$$\begin{aligned} &a_0 \; a_1 \; a_2 \; \ldots \; a_{d-1} \end{aligned}$$
  • aia_i is the minimum maintenance cost to connect all nn hosts at time point ii. If it is impossible to connect the hosts at that time point, then ai=−1a_i = -1.
5 5 6
1 2 5 0 4
2 3 1 0 4
4 5 3 2 6
5 1 1 1 5
2 5 2 3 6
-1 -1 10 7 -1 -1
6 10 6
1 2 5 0 6
1 6 1 4 6
3 4 2 3 6
5 2 4 2 6
4 5 1 0 6
6 3 9 5 6
3 4 8 0 6
3 2 6 0 6
1 4 3 1 6
6 5 4 0 6
24 19 18 14 11 11
4 8 7
1 4 1 4 5
2 3 1 0 7
2 1 1 0 1
4 2 1 1 3
3 1 1 2 6
1 2 1 5 7
3 4 1 0 3
4 3 1 6 7
3 -1 3 -1 3 -1 3

Hint

Constraints

  • 1≤n≤1051 \leq n \leq 10^5.
  • 1≤m≤3×1051 \leq m \leq 3 \times 10^5。
  • 1≤d≤3×1051 \leq d \leq 3 \times 10^5。
  • 1≤ui,vi≤n1 \leq u_i, v_i \leq n, and ui≠viu_i \neq v_i.
  • 1≤wi≤1091 \leq w_i \leq 10^9.
  • 0≤li<ri≤d0 \leq l_i < r_i \leq d.
  • All input values are integers.

Scoring

This problem has five subtasks, with the constraints as follows. Each subtask may contain one or more pieces of testdata. You will get the score for a subtask only if you pass all testdata in that subtask.

Subtask Score Additional Input Constraints
1 5 d=1d=1.
2 9 n≤100n \leq 100, ri=dr_i = d.
3 21 ri=dr_i = d.
4 26 wi=1w_i = 1.
5 39 No additional constraints.

Translated by ChatGPT 5