#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 . 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 , where = (computing nodes) + (relay nodes).
-
We define the safety coefficient as the largest such that for any two vertices , there are at least edge-disjoint paths from to (edge-disjoint means no repeated edges; repeated vertices are allowed).
-
We define the total work capacity of the selected nodes as .
-
Constraints:
- For 30% of the testdata, is no greater than 1e8.
- For 100% of the testdata, , , , and each query and are no more than .
- All numbers are positive integers.
Input Format
- The first line contains three integers , the number of computers, wireless links, and queries.
- The second line contains integers, the of the computers.
- Lines 3 to : each line contains two integers , indicating a direct wireless link between and ; no other guarantees.
- Lines to : each line contains one integer , representing the required total work capacity for that query.
Output Format
- Output lines. For each query, output one integer: under the requirement that the total work capacity is at least , 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
京公网安备 11011102002149号