Matrix Cipher
Time limit2sMemory limit512 MB
Given the 2x2 matrix formed by reading a bitstring and right-multiplying by one of the two elementary matrices per bit, recover the bitstring.
- Level
Medium6 of 10
- Topics
- Math, Simulation
- Solved
- No attempts yet
Problem
Alice holds her message to Bob as a bitstring and encodes it into a matrix. She starts from the identity matrix
and reads the bitstring one character at a time, starting from the leftmost bit. For a 0 bit she multiplies on the right by
that is, . For a 1 bit she multiplies on the right by
that is, . After the last bit she transmits the resulting matrix .
Bob deleted the program that decodes a message from Alice. Given the transmitted matrix, recover the original bitstring.
Input
The input consists of two lines. Line has two integers and separated by a space (, ), where
is the matrix holding the encoded message.
The original bitstring has length 1 to 120, and the input is always the encoding of one such bitstring.
Output
Print the decoded bitstring on one line. The bitstring that satisfies the conditions is unique.