Statistics

Problem Statement for "SketchGame"

Problem Statement

In an old video game, you are presented with a board which is x units wide, and y units high. The board is composed of x*y one by one squares and each of these squares has two possible states, on or off. The player in the game starts in the most northwestern corner at x = 0 and y = 0 and initially all the squares are in the off state. As the player moves around, each time he moves onto a new one by one square, that square's state toggles. So, if it was off it becomes on, and vice versa.

Your task is, given a String[] containing all of the information about how the player moves about on the board, and the dimensions of the board, x and y, return the final state of all the one by one squares.

The input String[], moves, will contain a list of movements in 1 of the four cardinal directions.
'N' is for north and indicates a move in the negative y direction.
'E' is for east and indicates a move in the positive x direction.
'S' is for south and indicates a move in the positive y direction.
'W' is for west and indicates a move in the negative x direction.
Each String in moves will start with one of these 4 characters, followed immediately by the number of tiles to move in that direction. Thus "N4" indicates a move of 4 tiles in the negative y direction.

Your method must execute all of these moves in the order they appear (i.e., element 0 first) and return a String[] with y elements, each of which has x characters where a '1' (the number one, not lowercase 'L') represents an on state, and a '0' (the number zero, not the letter oh) represents the off state.

Definition

Class:
SketchGame
Method:
draw
Parameters:
String[], int, int
Returns:
String[]
Method signature:
String[] draw(String[] moves, int x, int y)
(be sure your method is public)

Notes

  • states only toggle when stepping onto a new tile. When leaving a tile, or staying on a tile, the state of that tile does not change.
  • if a move would take the player off the board, instead he bumps into the wall and stops. (see example 2)
  • x is the number of characters that each String in the return must contain.
  • y is the number of elements in the return String[].
  • The initial state of all sqaures is off.

Constraints

  • x and y are both in the range 1 to 50, inclusive.
  • moves has between 0 and 50 elements, inclusive.
  • Each element of moves contains a single letter ('N','E','S', or 'W') followed by an integer between 0 and 100, inclusive (no leading '0's).

Examples

  1. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    50

    50

    Returns: { "00000000000000000000000000000000000000000000000000", "01111110001111000000000000000000000000000000000000", "00001000010001100000000000000000000000000000000000", "00001000010000000000000000000000000000000000000000", "00001000011001100000000000000000000000000000000000", "00001000001111000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000" }

  2. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    16

    7

    Returns: { "0000000000000000", "0111111000111100", "0000100001000110", "0000100001000000", "0000100001100110", "0000100000111100", "0000000000000000" }

  3. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    1

    1

    Returns: { "0" }

  4. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    15

    15

    Returns: { "000000000000000", "011111100011110", "000010000100011", "000010000100000", "000010000110011", "000010000011110", "000000000000000", "000000000000000", "000000000000000", "000000000000000", "000000000000000", "000000000000000", "000000000000000", "000000000000000", "000000000000000" }

  5. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3","N0"}

    16

    7

    Returns: { "0000000000000000", "0111111000111100", "0000100001000110", "0000100001000000", "0000100001100110", "0000100000111100", "0000000000000000" }

  6. {"E3"}

    5

    1

    Returns: { "01110" }

    We start at (0,0). We then move east to (1,0), and toggle the state from off to on. We then move east two more times, each time toggling a state, and after 3 moves we have toggled three of the squares to on.

  7. {"E3","W2"}

    5

    1

    Returns: { "00010" }

    Again, we move east 3 times and end up at (3,0) with (1,0), (2,0), and (3,0) in the on state. We then move west twice, turning (1,0) and (2,0) to the off state.

  8. {"E7","W2"}

    5

    1

    Returns: { "01001" }

    We move east 4 times and turn (1,0), (2,0), (3,0) and (4,0) to on. After this we keep trying to move east, but run into the wall, and so we do nothing. We then go west twice, turning (2,0) and (3,0) to off.

  9. {"E4","S6","W3","N2","E8"}

    10

    7

    Returns: { "0111100000", "0000100000", "0000100000", "0000100000", "0111011111", "0100100000", "0111100000" }

  10. {"E4","S6","W3","N2","E8"}

    3

    4

    Returns: { "011", "110", "101", "111" }

  11. {"S11","W42","N40","E7","S27","W42","S19","E49","E30","E43","N2","E18","E33","W46","N37","E28","W34","E24","N4","S1","N38","N37","N41","N36","S20","N7","E28","E4","W4","W18","E24","E33","S47","E8","N3","W23","W48","W34","N6","W10","N49","W27","N37","N24","N0","E22","E38","E8","N2","N19"}

    40

    40

    Returns: { "0111111100000000000000001111011111111111", "0000000100000000000000000000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "1000000100000000000000001000000000000000", "0000000100000000000000001000000000000000", "0000000100000000010000000111111111111110", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000001000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "0000000100000000000000000000000000000001", "1111111100000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1000000000000000000000000000000000000001", "1111111111111111111111111111111111111110", "0111111111111111111111111111111111111111", "1000000000000000000000000000000000000001", "1111111111111111111111111111111111111110" }

  12. {"S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1","N49","E1","S49","E1"}

    50

    50

    Returns: { "01111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111110000000000000000000000000", "11111111111111111111111111000000000000000000000000" }

  13. {"S39","S4","S35","E45","S15","E37","E0","N15","W6","W6","S41","W42","S16","W48","N31","S26","W45","E49","S47","W8","W34","S9","S23","E31","N45","S45","N37","N28","S20","W24","E8","E14","W48","E15","W21","S1","N18","S30","S17","S26","E38","N3","W0","N47","E49","E14","W18","W16","E24","N36"}

    50

    50

    Returns: { "00000000000000010000000000000000000000010000000001", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "00000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "00000000000000000000000000000000000000100000000000", "10000000000000000000000000000000000000100000000000", "11111111111111001111111111111111111101100000000000", "10000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000001111111111111", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "00000000000000000000000000000000000001000000000001", "01111111111111111111111111111111111110111111111110", "10000000000000000000000000000000000001000000000000", "10000000000000000000000000000000000001000000000000", "10000000000000000000000000000000000001000000000000", "10000000000000000000000000000000000001000000000000", "11111110111111111111111111111111111111100000000000" }

  14. {"S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0","S0"}

    20

    20

    Returns: { "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000", "00000000000000000000" }

  15. {"W3","E3"}

    5

    1

    Returns: { "01110" }

  16. {"E3","S1","W1"}

    2

    2

    Returns: { "01", "11" }

  17. {}

    5

    5

    Returns: { "00000", "00000", "00000", "00000", "00000" }

  18. {"E2"}

    2

    1

    Returns: { "01" }

  19. {"S100","W100","N25","E100"}

    50

    50

    Returns: { "00000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "01111111111111111111111111111111111111111111111111", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000" }

  20. {"W3","N5"}

    5

    3

    Returns: { "00000", "00000", "00000" }

  21. {"N1"}

    2

    2

    Returns: { "00", "00" }

  22. {"E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100","W100","N100","E100","S100"}

    50

    50

    Returns: { "01111111111111111111111111111111111111111111111111", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001", "00000000000000000000000000000000000000000000000001" }

  23. {"E10","S5"}

    5

    5

    Returns: { "01111", "00001", "00001", "00001", "00001" }

  24. {"S30"}

    5

    5

    Returns: { "00000", "10000", "10000", "10000", "10000" }

  25. {"E1"}

    5

    1

    Returns: { "01000" }

  26. {"N32","E12","W31","N74","S22","S1","S1","S1","W19","E8","N4","S12","E7","W6","W22","S12"}

    49

    49

    Returns: { "1000000000001000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000010000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1111111100000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "0000000010000000000000000000000000000000000000000", "1111111100000001000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000" }

  27. {"S25","E25","S25","E25","S25","W50"}

    45

    45

    Returns: { "000000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "100000000000000000000000000000000000000000000", "111111111111111111111111110000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "000000000000000000000000010000000000000000000", "111111111111111111111111100000000000000000001" }

  28. {"S10"}

    50

    1

    Returns: { "00000000000000000000000000000000000000000000000000" }

  29. {"E1"}

    5

    1

    Returns: { "01000" }

  30. {"S1"}

    1

    1

    Returns: { "0" }

  31. {"E2"}

    2

    2

    Returns: { "01", "00" }

  32. {"E3","W20","E2"}

    5

    1

    Returns: { "11110" }

  33. {"E3"}

    5

    1

    Returns: { "01110" }

  34. {"W5"}

    4

    5

    Returns: { "0000", "0000", "0000", "0000", "0000" }

  35. {"E7","W2"}

    5

    1

    Returns: { "01001" }

  36. {"E10"}

    4

    4

    Returns: { "0111", "0000", "0000", "0000" }

  37. {"E15"}

    20

    1

    Returns: { "01111111111111110000" }

  38. {"E100","S100"}

    49

    49

    Returns: { "0111111111111111111111111111111111111111111111111", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000001" }

  39. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N8","S3","N3","S2","N2","S10","N1","E1","W1","E2","W10","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E10","W3"}

    5

    5

    Returns: { "11111", "01101", "00000", "11101", "00001" }

  40. {"N12","E12","S12"}

    50

    50

    Returns: { "01111111111110000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000010000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000" }

  41. {"S5"}

    5

    5

    Returns: { "00000", "10000", "10000", "10000", "10000" }

  42. {"E2"}

    2

    1

    Returns: { "01" }

  43. {"E5","S7","W3","N2","E9"}

    3

    4

    Returns: { "011", "110", "101", "111" }

  44. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4","S3","N3","S2","N2","S1","N1","E1","W1","E2","W1","E2","W1","E3","W1","E1","S3","E1","S1","E3","N1","E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    14

    5

    Returns: { "00001110011110", "01110000010011", "00001000010000", "00001000011001", "00001000001111" }

  45. {"E9","W6"}

    3

    4

    Returns: { "101", "000", "000", "000" }

  46. {"E10"}

    1

    2

    Returns: { "0", "0" }

  47. {"E11"}

    12

    12

    Returns: { "011111111111", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000", "000000000000" }

  48. {"E3","W3"}

    3

    3

    Returns: { "101", "000", "000" }

  49. {"W5","E7"}

    7

    7

    Returns: { "0111111", "0000000", "0000000", "0000000", "0000000", "0000000", "0000000" }

  50. {"E4","S0","S6","N0","N0","W3","N2","E8"}

    10

    10

    Returns: { "0111100000", "0000100000", "0000100000", "0000100000", "0111011111", "0100100000", "0111100000", "0000000000", "0000000000", "0000000000" }

  51. {"N1","N1","N3","N4","E1","E3","E4","W3","W1","W3","S3","S5","W5","E5","S1","S1","S1","S1","N1","N1","N1","E3","W5","E2","S4","N2","N4","N4","W4","W5","E2","W3","E5","S4","S1","S1","S1","N2","N2","N1","E1","W2","W3","S1","N3","S2","S2","N1","N4","W3"}

    49

    49

    Returns: { "0000000010000000000000000000000000000000000000000", "0100000000000000000000000000000000000000000000000", "1000000000000000000000000000000000000000000000000", "0110000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0111101000000000000000000000000000000000000000000", "0000010000000000000000000000000000000000000000000", "0000010000000000000000000000000000000000000000000", "1011100000000000000000000000000000000000000000000", "0001010010000000000000000000000000000000000000000", "0000010000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000010000000000000000000000000000000000000000000", "0000010000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000" }

  52. {"S1","S0","E2"}

    3

    3

    Returns: { "000", "111", "000" }

  53. {"N25","S12","E15"}

    40

    40

    Returns: { "0000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1000000000000000000000000000000000000000", "1111111111111111000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000" }

  54. {"E1"}

    1

    2

    Returns: { "0", "0" }

  55. {"S99","E99","N25","W25"}

    50

    50

    Returns: { "00000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000011111111111111111111111111", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "10000000000000000000000000000000000000000000000001", "11111111111111111111111111111111111111111111111111" }

  56. {"S3"}

    5

    1

    Returns: { "00000" }

  57. {"E1","W1"}

    2

    1

    Returns: { "11" }

  58. {"E43","W22","N6","S1","S2","E3","S33"}

    15

    30

    Returns: { "100000000000001", "100000000000000", "100000000000000", "111100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000", "000100000000000" }

  59. {"E3","W3"}

    5

    1

    Returns: { "10010" }

  60. {"S25","E25","N10","W10"}

    50

    50

    Returns: { "00000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000000000000000000000000000000000000000", "10000000000000011111111111000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "10000000000000000000000001000000000000000000000000", "11111111111111111111111111000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000", "00000000000000000000000000000000000000000000000000" }

  61. {"E20","W10","E2"}

    10

    10

    Returns: { "1110000001", "0000000000", "0000000000", "0000000000", "0000000000", "0000000000", "0000000000", "0000000000", "0000000000", "0000000000" }

  62. {"E30","W11"}

    41

    1

    Returns: { "01111111111111111110000000000010000000000" }

  63. {"N5","E1","N4","S1","W4","E7","S10","W11"}

    2

    3

    Returns: { "01", "10", "11" }

  64. {"E3"}

    5

    1

    Returns: { "01110" }

  65. {"E4","S5","N2","W2","S1","E1","S11"}

    3

    3

    Returns: { "100", "110", "011" }

  66. {"E1","S2","N2","S2","N1","E3","W3","E3","S4","N4" ,"S3","N3","S2","N2","S1","N1","E1","W1","E2","W1" ,"E2","W1","E3","W1","E1","S3","E1","S1","E3","N1" ,"E1","N3","S2","N1","W1","N1","W3","E4","W3"}

    16

    7

    Returns: { "0000000000000000", "0111111000111100", "0000100001000110", "0000100001000000", "0000100001100110", "0000100000111100", "0000000000000000" }


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: