#P3729. 曼哈顿计划EX

曼哈顿计划EX

Description

  • Aiden has a computer network. Each computer has an insane configuration of at least Intel Xeon E50 v40 + 40-way GTX10800Titan, and they are connected directly or indirectly by wireless links, which can be represented by an undirected connected graph. However, his network is not secure enough: DedSec may attack it and cut some wireless links, causing the network to become disconnected. To prevent this, Aiden decides to select some computers as computing nodes, and use the others as relay nodes, to carry out the task of stopping the nuclear launch. Although every machine is high-end, there are differences between knockoff parts and genuine parts—each computer has a different work capacity, denoted wi w_{i}. Now Aiden wants to know: given a required work capacity, what is the maximum safety coefficient of the entire network?

  • Let the given graph be G=(V,E)G = (V , E), where VV = V1V_{1} (computing nodes) + V2V_{2} (relay nodes).

  • We define the safety coefficient kk as the largest kk such that for any two vertices u,vV1u, v \in V_{1}, there are at least kk edge-disjoint paths from uu to vv (edge-disjoint means no repeated edges; repeated vertices are allowed).

  • We define the total work capacity of the selected nodes as W=vV1wvW = \sum_{v \in V_{1}}{w_{v}}.

  • Constraints:

    • For 30% of the testdata, qn4qn^{4} is no greater than 1e8.
    • For 100% of the testdata, n550n \le 550, m3000m \le 3000, q2017q \le 2017, and each query and wiw_{i} are no more than 10610^{6}.
    • All numbers are positive integers.

Input Format

  • The first line contains three integers n,m,qn, m, q, the number of computers, wireless links, and queries.
  • The second line contains nn integers, the wiw_{i} of the computers.
  • Lines 3 to m+2m+2: each line contains two integers u,vu, v, indicating a direct wireless link between uu and vv; no other guarantees.
  • Lines m+3m+3 to m+q+2m+q+2: each line contains one integer KK, representing the required total work capacity for that query.

Output Format

  • Output qq lines. For each query, output one integer: under the requirement that the total work capacity is at least KK, the maximum safety coefficient of the network. If the requirement can be met using only one computer, output "nan".
  • If it is impossible to meet the requirement, output "Nuclear launch detected".
  • Outputting only "nan" will not score.
4 5 3
1 1 1 1
1 2
1 3
2 3
1 4
2 4
1
3
5
nan
2
Nuclear launch detected

Hint

  • For query 1, choosing any single computer as a computing node is a valid solution.
  • For query 2, at least three computers must be selected; any three form a valid solution. The three selected vertices form a triangle; for any two vertices there are two ways to reach each other (clockwise and counterclockwise along the triangle), so the answer is 2.
  • For query 3, selecting all computers is still insufficient.

Translated by ChatGPT 5