|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|5 초||64 MB||0||0||0||0.000%|
Somewhere in the sky, KM kingdom built n floating islands by their highly developed technology. The islands are numbered from 1 to n.
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 H. For floating the island i to the altitude hi, it costs bihi. Besides, it costs |hi − hj|ci,j for each pair of islands i and j 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.
The input contains several test cases. Each test case starts with a line containing two integers n (1 ≤ n ≤ 100) and H (0 ≤ H ≤ 1,000), separated by a single space. The next line contains n integers b1, b2,..., bn (0 ≤ bi ≤ 1,000). Each of the next n lines contains n integers ci,j (0 ≤ ci,j ≤ 1,000). You may assume ci,i = 0 and ci,j = cj,i.
The last test case is followed by a line containing two zeros.
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 (1 − 10−9)H, and the cost calculated from your answer has an absolute or relative error less than 10−9 from the optimal solution.
Follow the format of the sample output.
2 1 1 3 0 1 1 0 3 3 1 2 4 0 2 0 2 0 1 0 1 0 0 0
Case 1: 0.75 0.25 Case 2: 1.5 1.5 0.0