For a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation.
<!-- MATH
\begin{displaymath}
Ratio = \frac{\sum edge \ weight}{\sum node \ weight}
\end{displaymath}
-->
Given a complete graph of n
Input contains multiple test cases. The first line of each test case contains two integers n
$(2 \le n \le 15)$
-->
(2<=n<=15)
$(2 \le m \le n)$
-->
(2<=m<=n)
$n \times n$
-->
n×n
All the weights of both nodes and edges (except for the ones on the diagonal of the matrix) are integers and in the range of [1, 100].
The figure below illustrates the first test case in sample input. Node 1 and Node 3 form the minimal ratio tree.
For each test case output one line contains a sequence of the m nodes which constructs the minimal ratio tree. Nodes should be arranged in ascending order. If there are several such sequences, pick the one which has the smallest node number; if there's a tie, look at the second smallest node number, etc. Please note that the nodes are numbered from 1.
3 2 30 20 10 0 6 2 6 0 3 2 3 0 2 2 1 1 0 2 2 0 0 0
1 3 1 2
Migrated from old NTUJ.
ICPC 2008, Beijing
No. | Testdata Range | Score |
---|