Latin squares X30739


Statement
 

pdf   zip

html

Input The first line is an array representation of a Latin square of order n, followed by other lines that represent nxn matrices with the same set of symbols.

Output The output is the list of arrays being orthogonal Latin squares for the provided in the first line of the input. In this case, those in lines 2 and 3, since 4 is not a Latin square and 5 is not orthogonal.

Public test cases
  • Input

    {(1,1,A),(1,2,B),(1,3,C),(2,1,C),(2,2,A),(2,3,B),(3,1,B),(3,2,C),(3,3,A) }
    { (1,1,A),(1,2,B),(1,3,C),(2,1,B),(2,2,C),(2,3,A),(3,1,C),(3,2,A),(3,3,B) }
    { (1,1,B),(1,2,C),(1,3,A),(2,1,C),(2,2,A),(2,3,B),(3,1,A),(3,2,B),(3,3,C) }
    { (1,1,A),(1,2,A),(1,3,A),(2,1,B),(2,2,C),(2,3,A),(3,1,C),(3,2,A),(3,3,B) }
    { (1,1,B),(1,2,A),(1,3,C),(2,1,C),(2,2,B),(2,3,A),(3,1,A),(3,2,C),(3,3,B) }
    

    Output

    { (1,1,A),(1,2,B),(1,3,C),(2,1,B),(2,2,C),(2,3,A),(3,1,C),(3,2,A),(3,3,B) }
    { (1,1,B),(1,2,C),(1,3,A),(2,1,C),(2,2,A),(2,3,B),(3,1,A),(3,2,B),(3,3,C) }
    
  • Information
    Author
    HP CodeWars
    Language
    English
    Official solutions
    C++
    User solutions