Matrix (Easy)#5313

Matrix (Easy)

1 sekondë
64 megabajt
Shumë e vështirë

You are given an n \times n matrix of integers. Your task is to select a set of coordinates (k_i, l_i) such that each row index k_i and each column index l_i is used exactly once, in order to minimize the sum of the selected matrix elements.

Hyrja

The first line contains a single integer (1 \leq n \leq 50). The following lines each contain integers, each within the range -10^6 to 10^6.

Dalja

The first line should display the minimum possible sum. In the following lines, output the pairs of numbers representing the selected cells, with the row number given first.

Shembuj

Shembulli 1

Loading
Loading