Problem 42806. GJam 2016 Rd1A: Rank and File (Large)
This Challenge is derived from GJam Rd1A 2016 Rank and File. This is the first 26 large cases with max N=50.
The GJam story is a matrix H(NxN) which has every row and column increasing. Each row and column is recorded on strips. The strips get scrambled and one gets incinerated. The goal is to reconstruct the missing increasing vector strip.
Input: [M], matrix of size [2*N-1,N] of all rows and columns of H except one
Output: [V], the missing vector of H not included in M
Examples: [M] [V]
[1 2 3;2 3 5;3 5 6;2 3 4;1 2 3] [3 4 6] [22 222;2 22;2 22][22 222]
GJam 2016 Rd1A Matlab results show three qualifiers for Rd2.
Theory: Brute force permutation will not succeed in a timely manner for N=50. Recreating the original matrix is possible in a timely manner. The min corner or the max corner will always be available. Evolving solution, no guessing, is possible. OR one can observe an inherent mathematical result to create a 1-line solution. GJam Rank_file solutions.
Solution Stats
Problem Comments
-
1 Comment
A better description for this problem can be found at http://joonprogramming.blogspot.com/2016/04/google-code-jam-qualification-round-1a_17.html We have to find an NXN matrix, without repeating numbers at any row or column that must be ordered. And we have 2*N-1 strips of scrambled numbers, which can be rows or columns. The problem is to find what the missing strip is (notice that a NXN matrix has 2*N strips).
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
Remove any row in which a NaN appears
8587 Solvers
-
2584 Solvers
-
500 Solvers
-
119 Solvers
-
589 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!