How to solve this problem?

Revision en2, by viniciusth, 2019-09-16 15:39:27

Given a NxN grid, you need to choose one element in each row and every element must be in a distinct column (Like placing N rooks in a NxN grid).

Print the elements you chose in each row such that they have maximum possible sum. (Any possible answer is accepted) $$$1 \leq N \leq 100$$$

$$$1 \leq A_{i,j} \leq 100$$$

Example input:

3
1 10 12
13 5 15
20 2 5

Example output:

2 3 1

Preferably i want to solve the problem when the size of elements doesn't really matter (Say, $$$A_{i,j} \leq 10^9$$$).

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English viniciusth 2019-09-16 15:39:27 116 Tiny change: 'ter (Say, below 10^9).\n' -> 'ter (Say, $A_{i,j} \leq 10^9$).\n'
en1 English viniciusth 2019-09-16 15:36:11 460 Initial revision (published)