eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків

Skyland

\textit{n} \textit{n} Somewhere in the sky, KM kingdom built floating islands by their highly developed technology. The islands are numbered from 1 to . \textit{H} \textit{i} \textit{h}_i \textit{b}_i\textit{h}_i |\textit{h}_i−\textit{h}_j|\textit{c}_\{i,j\} \textit{i} \textit{j} The king of the country, Kita_masa, can choose any non-negative real number as the altitude for each island, as long as the sum of the altitudes is greater than or equals to . For floating the island to the altitude , it costs . Besides, it costs for each pair of islands and since there are communications between these islands. Recently, energy prices are rising, so the king, Kita_masa, wants to minimize the sum of the costs. The king ordered you, a court programmer, to write a program that finds the altitudes of the floating islands that minimize the cost. \InputFile \textit{n} 1 ≤ \textit{n }≤ 100 \textit{H} 0 ≤ \textit{H} ≤ 1000 \textit{n} \textit{b}_1 \textit{b}_2 \textit{b}_n 0 ≤ \textit{b}_i ≤ 1000 \textit{n} \textit{n} \textit{c}_\{i,j\} 0 ≤ \textit{c}_\{i,j\} ≤ 1000 \textit{c}_\{i,i\}=0 \textit{c}_\{i,j\}=\textit{c}_\{j,i\} The input contains several test cases. Each test case starts with a line containing two integers () and (), separated by a single space. The next line contains integers , ,..., (). Each of the next lines contains integers (). You may assume and . The last test case is followed by a line containing two zeros. \OutputFile (\textbf{1−} \textbf{10^\{-9\}} ) \textit{H} \textbf{10^\{-9\}} For each test case, print its case number. Then print a line containing a space-separated list of the altitudes of the islands that minimizes the sum of the costs. If there are several possible solutions, print any of them. Your answer will be accepted if the altitude of each island is non-negative, sum of the altitudes is greater than , and the cost calculated from your answer has an absolute or relative error less than from the optimal solution. Follow the format of the sample output.
Ліміт часу 5 секунд
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2 1
1 3
0 1
1 0
3 3
1 2 4
0 2 0
2 0 1
0 1 0
0 0
Вихідні дані #1
Case 1:
0.75 0.25
Case 2:
1.5 1.5 0.0
Джерело ACM-ICPC Japan Alumni Group Spring Contest 2012 , Tokyo, Japan, 2012-04-15