Your ship has found the stricken vessel from day 4 and has docked up alongside ready to perform a rescue operation! Keen to help out, you put on a space suit and join the expedition team. You and the team float the short distance to the other ship to enter through their airlock. As you reach the airlock you discover there is a keypad requiring a passcode before you and your rescue team will be able to enter. The distress signal didn't mention anything about a passcode! You are going to have to try to hack the code so you can get inside the ship. You use the computer that is conveniently built into your spacesuit to interface with the ship and get to work.
Looking for a vulnerability in the system, you discover the graphical subroutine on the airlock door keeps a cache of pixel patterns that have been displayed. While it is a little, you realise you can use this! If you can determine what pixels were lit when someone had correctly entered the passcode, you could use that to gain entrance!
The screen for the passcode is 50 pixels wide by 10 pixels high. The graphics subsystem records pixel patterns as a sequence of rectangle commands. Each rectangle consists of four values representing the left edge, top edge, width and height of the rectangle. The left and top edges are location 0,0.
If a rectangle is being drawn such that it partially overlaps an existing rectangle, pixels that were previously already on will be turned off.
While the actual passcode system is 50 by 10 pixels, for this example let's just keep to 8x8.
Consider the following example data.
1 1 6 4
2 2 5 2
1 5 1 3
2 7 5 1
The first rectangle, given by 1 1 6 4
, starts at x=1, y=1 and has width=6 and height=4. Plotting this into our 8x8 pixels gives.
........
.######.
.######.
.######.
.######.
........
........
........
The second rectangle, given by 2 2 5 2
, starts at x=2, y=2 and has width=5 and height=2. Notice that these pixels are already on, meaning that they now invert back to the off state.
........
.######.
.#......
.#......
.######.
........
........
........
The third rectangle, given by 1 5 1 3
, starts at x=1, y=5 and has width=1 and height=3.
........
.######.
.#......
.#......
.######.
.#......
.#......
.#......
The forth rectangle, given by 2 7 5 1
, starts at x=2, y=7 and has width=5 and height=1.
........
.######.
.#......
.#......
.######.
.#......
.#......
.######.
These pixels can be read as displaying the letter E
which would be the answer.
Process the input data for the 50x10 pixels provided to determine the secret passcode.