mirror of
https://github.com/xlucn/PAT.git
synced 2026-10-28 18:41:38 +08:00
15 lines
1.4 KiB
HTML
15 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<h1>1001. Battle Over Cities - Hard Version (35)</h1>
|
|
<div id="problemContent">
|
|
<p>It is vitally important to have all the cities connected by highways in a war. If a city is conquered by the enemy, all the highways from/toward that city will be closed. To keep the rest of the cities connected, we must repair some highways with the minimum cost. On the other hand, if losing a city will cost us too much to rebuild the connection, we must pay more attention to that city.</p>
|
|
<p>Given the map of cities which have all the destroyed and remaining highways marked, you are supposed to point out the city to which we must pay the most attention.
|
|
</p>
|
|
<p><b>Input Specification:</b></p>
|
|
<p>Each input file contains one test case. Each case starts with a line containing 2 numbers N (<=500), and M, which are the total number of cities, and the number of highways, respectively. Then M lines follow, each describes a highway by 4 integers:</p>
|
|
<pre>
|
|
City1 City2 Cost Status
|
|
</pre>
|
|
<p>where City1 and City2 are the numbers of the cities the highway connects (the cities are numbered from 1 to N), Cost is the effort taken to repair that highway if necessary, and Status is either 0, meaning that highway is destroyed, or 1, meaning that highway is in use.</p>
|
|
<p>Note: It is guaranteed that the whole country was connected before the war.</p>
|
|
</div> |