Problem 42805. GJam 2016 Rd1A: Rank and File (small)
This Challenge is derived from GJam Rd1A 2016 Rank and File. This is the small case with max N=10
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: With max N=10 it is possible to brute force the 50 puzzles. Persistent may be useful with the usage of nchoosek which may be the critical path. GJam Rank_file solutions. Writing the general solution for N=50 is better for the contest. 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.
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
-
3530 Solvers
-
294 Solvers
-
268 Solvers
-
Given a window, how many subsets of a vector sum positive
855 Solvers
-
Replace multiples of 5 with NaN
442 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!