Statistics

Problem Statement for "BinaryBoard"

Problem Statement

We have a 6 x 6 square board, and we place in each square one of the digits 0 and 1. On this board we can then read 12 binary numbers, 6 horizontal and 6 vertical. We call the horizontal numbers "H1" (the number in the first row) to "H6" (the number in the last row) and the vertical numbers "V1" (the number in the first column) to "V6" (the number in the last column). We will fill in the board so that the 12 numbers are distinct and we can sort them in strictly increasing order.

You will be given order, a String[] containing the names of the 12 numbers in order of increasing values, and are to return a String[] representing the digits in the board. The ith element of the return value shall represent the ith row. The constraints will guarantee that there is exactly one way to place the digits 0 and 1 in the board so that the given order is created. See the first example for more details.

Definition

Class:
BinaryBoard
Method:
board
Parameters:
String[]
Returns:
String[]
Method signature:
String[] board(String[] order)
(be sure your method is public)

Constraints

  • order will contain exactly 12 elements.
  • Each element of order will contain exactly 2 characters. The first character will be 'H' or 'V', the second character will be a digit between '1' and '6', inclusive.
  • All elements of order will be different.
  • The input values will be such that there is exactly one board satisfying the given order.

Examples

  1. {"V2", "V5", "H4", "V6", "H5", "H3", "V4", "H1", "V3", "V1", "H6", "H2"}

    Returns: {"101100", "111011", "100011", "011101", "011111", "111010" }

    The 12 numbers in the rows and columns of the returned board are: H1 = 101100 V1 = 111001 H2 = 111011 V2 = 010111 H3 = 100011 V3 = 110111 H4 = 011101 V4 = 100110 H5 = 011111 V5 = 011011 H6 = 111010 V6 = 011110 It is easy to verify that this conforms to the given order: V2 < V5 < H4 < ... < H2.

  2. {"V4", "H4", "H2", "V1", "H5", "V6", "H6", "H3", "V3", "H1", "V2", "V5"}

    Returns: {"111011", "011110", "110011", "011011", "101100", "101111" }

  3. {"V4", "H6", "H3", "V1", "H2", "H1", "H4", "V3", "V6", "H5", "V5", "V2"}

    Returns: {"011011", "010000", "000011", "100000", "101010", "000010" }

  4. {"H1", "H6", "V1", "H5", "H3", "V2", "V4", "H2", "V3", "V5", "V6", "H4"}

    Returns: {"001111", "111011", "011011", "111111", "010101", "010010" }

  5. {"H3", "V2", "H1", "H5", "V5", "H6", "V6", "V1", "H2", "H4", "V3", "V4"}

    Returns: {"001100", "101111", "000100", "110000", "001101", "010001" }

  6. {"V1", "H3", "H1", "H4", "H6", "V4", "H2", "V3", "V2", "V6", "V5", "H5"}

    Returns: {"011111", "100011", "011000", "100000", "110110", "100001" }

  7. {"V4", "H6", "V1", "H3", "H4", "H2", "V6", "V5", "H1", "V3", "V2", "H5"}

    Returns: {"011000", "010011", "001000", "001011", "111010", "000001" }

  8. {"V4", "V5", "H6", "H1", "H5", "V2", "H4", "V1", "H3", "H2", "V6", "V3"}

    Returns: {"001001", "111001", "101001", "010110", "001011", "001000" }

  9. {"V5", "H4", "V3", "H3", "V4", "H1", "V1", "H2", "H6", "H5", "V6", "V2"}

    Returns: {"110001", "110101", "011101", "000100", "110111", "110110" }

  10. {"H3", "V4", "V2", "H4", "H1", "V1", "V5", "H5", "V6", "V3", "H6", "H2"}

    Returns: {"101011", "111111", "001011", "100000", "111001", "111100" }

  11. {"V3", "H3", "H4", "V5", "H2", "V1", "H1", "H5", "H6", "V6", "V4", "V2"}

    Returns: {"110101", "011111", "010111", "011000", "110110", "110111" }

  12. {"H1", "V3", "V6", "H4", "H3", "V4", "V1", "H6", "V2", "H2", "V5", "H5"}

    Returns: {"000010", "110110", "010000", "001011", "111011", "010111" }

  13. {"V6", "V4", "H6", "V3", "V5", "H3", "H2", "V1", "H1", "V2", "H5", "H4"}

    Returns: {"110000", "010000", "001111", "111010", "110111", "001100" }

  14. {"V1", "H2", "H1", "H6", "H3", "V5", "H5", "V2", "H4", "V4", "V6", "V3"}

    Returns: {"011111", "011101", "101010", "110101", "101111", "100011" }

  15. {"V2", "V3", "H3", "H5", "H1", "H6", "V1", "H4", "V6", "V5", "V4", "H2"}

    Returns: {"100111", "111111", "011111", "111000", "100110", "101101" }

  16. {"H2", "V4", "V6", "H5", "H4", "V3", "V5", "H3", "H6", "V2", "V1", "H1"}

    Returns: {"111010", "000001", "100100", "010100", "010010", "100101" }

  17. {"H1", "V6", "V3", "H3", "V4", "H6", "H4", "V5", "V1", "H5", "V2", "H2"}

    Returns: {"000000", "110000", "000110", "001010", "010001", "001001" }

  18. {"V3", "V5", "V4", "V2", "V6", "H5", "H1", "H2", "H4", "V1", "H3", "H6"}

    Returns: {"100000", "100001", "111110", "110100", "010010", "111111" }

  19. {"H3", "H2", "H6", "V2", "V1", "V4", "H5", "V5", "H1", "H4", "V6", "V3"}

    Returns: {"101111", "011001", "010110", "110000", "101010", "011011" }

  20. {"H3", "V2", "H5", "H6", "V3", "H4", "H1", "H2", "V4", "V5", "V6", "V1"}

    Returns: {"100111", "101111", "000000", "100000", "001011", "010001" }

  21. {"H4", "V6", "H3", "V1", "H1", "H6", "H2", "V3", "H5", "V2", "V4", "V5"}

    Returns: {"011110", "100110", "010001", "001011", "101000", "011111" }

  22. {"V2", "H4", "H1", "V3", "V4", "V6", "H5", "H6", "V1", "H2", "V5", "H3"}

    Returns: {"000010", "100000", "100101", "000001", "001110", "001111" }

  23. {"H2", "H5", "V4", "H4", "H3", "H6", "V2", "V1", "V5", "H1", "V6", "V3"}

    Returns: {"101011", "010100", "011101", "011011", "011000", "011110" }

  24. {"V4", "V2", "V6", "H5", "H6", "H3", "H4", "V3", "H2", "V5", "H1", "V1"}

    Returns: {"101010", "100001", "010100", "010110", "010010", "010011" }

  25. {"V1", "H3", "V6", "H2", "H6", "V4", "H5", "H1", "V3", "V5", "H4", "V2"}

    Returns: {"010000", "001010", "000110", "011101", "001111", "001011" }

  26. {"V1", "H3", "H6", "V4", "H1", "V5", "H5", "V6", "V3", "H2", "V2", "H4"}

    Returns: {"010000", "011011", "001100", "110111", "010101", "001101" }

  27. {"H4", "V3", "H1", "V4", "V1", "V5", "H3", "H6", "H2", "V6", "H5", "V2"}

    Returns: {"010011", "110111", "110101", "000000", "111010", "110110" }

  28. {"V1", "V4", "H1", "H5", "H6", "H3", "H4", "V2", "V5", "H2", "V3", "V6"}

    Returns: {"001001", "011011", "001101", "010011", "001010", "001011" }

  29. {"H6", "H1", "V1", "V2", "V4", "H4", "H2", "V3", "H5", "V6", "H3", "V5"}

    Returns: {"000011", "011100", "101110", "011011", "011111", "000010" }

  30. {"H3", "V4", "H6", "V2", "V5", "H5", "V3", "H2", "H4", "H1", "V6", "V1"}

    Returns: {"100001", "011110", "001010", "100000", "011001", "010001" }

  31. {"H5", "V1", "H2", "H1", "H4", "V2", "H3", "H6", "V6", "V4", "V3", "V5"}

    Returns: {"011111", "001111", "101111", "100000", "001010", "110110" }

  32. {"H3", "V2", "H4", "H5", "V3", "V5", "H2", "H6", "H1", "V4", "V6", "V1"}

    Returns: {"101111", "100101", "000000", "010010", "100000", "101001" }

  33. {"H4", "H6", "H2", "V5", "V6", "V3", "H5", "H3", "V4", "V2", "V1", "H1"}

    Returns: {"110100", "001011", "100000", "000000", "011000", "000101" }

  34. {"V2", "H6", "V4", "V6", "H5", "H3", "H2", "H4", "V5", "V1", "H1", "V3"}

    Returns: {"101000", "001010", "001000", "001011", "000110", "000001" }

  35. {"H1", "H4", "V5", "H6", "H3", "V1", "V2", "V6", "H5", "V4", "H2", "V3"}

    Returns: {"001000", "111101", "001110", "001011", "011000", "001101" }

  36. {"V1", "H6", "V6", "H3", "H5", "V4", "H1", "V3", "H4", "H2", "V2", "V5"}

    Returns: {"010010", "011010", "000110", "011000", "000111", "000001" }

  37. {"V4", "H3", "V1", "V6", "V5", "H4", "H1", "H2", "V3", "V2", "H6", "H5"}

    Returns: {"011000", "011010", "000001", "010001", "111001", "111000" }

  38. {"V3", "V2", "V5", "V6", "H6", "H2", "H4", "H1", "V1", "H5", "H3", "V4"}

    Returns: {"100100", "011111", "110111", "100000", "101111", "011101" }

  39. {"V1", "V6", "H4", "H1", "H6", "H5", "V5", "V4", "H3", "H2", "V2", "V3"}

    Returns: {"001000", "010100", "010010", "000010", "001010", "001001" }

  40. {"V5", "H2", "H5", "V3", "V1", "H6", "V4", "H1", "V2", "V6", "H3", "H4"}

    Returns: {"010001", "000001", "110100", "111100", "000100", "001101" }

  41. {"H1", "V6", "V3", "V4", "V2", "V5", "H5", "H3", "H6", "V1", "H2", "H4"}

    Returns: {"000000", "100000", "010010", "100100", "001110", "010011" }

  42. {"H2", "V3", "V4", "H4", "H6", "V1", "H1", "V6", "H5", "V2", "H3", "V5"}

    Returns: {"010010", "000001", "100011", "000110", "011010", "000111" }

  43. {"V5", "V3", "V4", "H2", "V2", "H5", "H3", "V6", "H6", "H4", "H1", "V1"}

    Returns: {"110101", "101001", "110000", "110100", "101110", "110011" }

  44. {"V2", "V6", "V4", "H2", "H5", "V5", "V3", "H3", "H4", "H1", "H6", "V1"}

    Returns: {"101010", "100000", "100101", "101000", "100010", "110110" }

  45. {"H2", "H6", "V4", "V6", "V1", "H4", "V3", "H5", "H3", "V5", "V2", "H1"}

    Returns: {"111111", "011010", "110111", "110000", "110101", "101001" }

  46. {"H1", "V1", "V5", "V4", "H6", "V6", "H5", "H2", "V2", "V3", "H4", "H3"}

    Returns: {"000000", "011001", "111110", "101111", "010111", "010100" }

  47. {"V2", "V4", "V5", "H6", "H3", "H4", "V3", "H2", "V6", "H1", "V1", "H5"}

    Returns: {"101001", "100110", "100000", "100001", "111111", "011011" }

  48. {"V4", "V5", "H1", "V1", "H5", "H6", "V2", "V3", "V6", "H2", "H4", "H3"}

    Returns: {"001001", "110000", "111001", "110011", "011101", "011110" }

  49. {"H2", "V5", "H3", "H6", "H4", "V3", "V4", "V2", "H5", "V1", "H1", "V6"}

    Returns: {"110001", "000101", "001010", "001100", "100001", "001011" }

  50. {"H5", "H6", "H3", "V5", "V3", "H2", "V1", "H1", "V4", "H4", "V6", "V2"}

    Returns: {"110101", "011111", "010101", "111010", "001011", "001101" }

  51. {"H1", "V4", "V6", "H5", "V5", "V1", "H3", "V2", "H2", "H6", "V3", "H4"}

    Returns: {"001000", "111010", "011101", "111111", "010001", "111100" }

  52. {"H3", "H4", "V4", "V3", "H2", "V5", "V6", "H6", "V1", "H5", "H1", "V2"}

    Returns: {"110001", "011110", "001110", "010010", "101010", "100010" }

  53. {"V2", "H1", "V3", "V1", "V5", "H4", "H3", "H6", "H5", "V4", "V6", "H2"}

    Returns: {"000101", "101010", "100010", "011111", "100101", "100011" }


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: