Editorial for COCI '07 Contest 3 #3 Tajna


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.

We calculate R and C from the length of the message.

One way to reconstruct the message is to construct the matrix and write the encrypted message in column-major order, and then read it in row-major order (because this is the opposite of what Mirko does to encrypt the message).

Another way is to see that what we really output are, in order, characters at indices 1, 1+R, \dots, N-R+1, 2, 2+R, \dots, N-R+2, \dots, R, R+R, \dots, N.


Comments

There are no comments at the moment.