Editorial for DMPG '19 S2 - Code Cracking Crisis


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: AvaLovelace

First, we find the inverse k^{-1} of the encryption keys—k^{-1}[i][j] is equal to the position of digit j in the i-th key.

Then we can decrypt the code from left to right. As we obtain each d[i], we can find d[i + 1] by seeing which digit in the d[i]-th key would result in an encrypted digit of e[i + 1].


Comments

There are no comments at the moment.