codyssi_2025/04_aeolian_transmissions/README.md

5.9 KiB
Raw Blame History

Codyssi - Aeolian Transmissions!

Part 1

Difficulty Rating: 1

Its been a day on the ship—youre feeling a little sick, but its becoming more bearable.

Oh! You suddenly remember that youll have to inform Aeolus assistants of your upcoming visit to the Aeolian Islands.

You reach for your aeolian transmitter, a special device that enables foreigners to send transmissions to the Aeolian Islands. The device has a special way to store encrypted messages:

Encrypted messages consist of uppercase alphabetical characters.

The amount of memory units used up by an alphabetical character is equal to its position in the alphabet.

For example, the character A takes up 1 memory unit, B takes up 2 memory units, C takes up 3 memory units, and so on. Following this pattern, Z will take up 26 memory units.

The lab team has already drafted and encrypted the message, but theyll need you to send it using your aeolian transmitter. Apparently, it would ruin the mission if they tried to send the message themselves…

First, the lab team needs you to determine the number of memory units required to store the entire message on the aeolian transmitter.

For example, consider the shorter message below:

NNBUSSSSSDSSZZZZMMMMMMMM PWAAASYBRRREEEEEEE FBBOFFFKDDDDDDDDD VJAANCPKKLZSSSSSSSSS NNNNNNBBVVVVVVVVV

There are only 5 lines in this shorter message.

The first line takes up 396 memory units. The second line takes up 177 memory units. The third line takes up 90 memory units. The fourth line takes up 298 memory units. The fifth line takes up 286 memory units. So, 1247 memory units are required to store the shorter message on the aeolian transmitter.

However, your message contains 100 lines, and each line is much longer.

What is the number of memory units required to store your message on the aeolian transmitter?

Part 2

Difficulty Rating: 2

After the calculation, you send the file size of the message on the aeolian transmitter to the lab.

After a few minutes, you receive a reply: “That should be fine, but it would be much safer if you found a way to reduce the messages file size…”

They seem a little worried. Its probably best if you follow their advice…

You check the aeolian transmitters notes on compression. There it is! Theres a lossy compression scheme thatll reduce the file size significantly!

The lossy compression scheme is used on each line individually. The number of characters kept at the start and end of each line is found by dividing the length of the original line by 10, then rounding down if necessary. Then, the middle of the line is replaced by the number of alphabetical characters removed from the line.

Of course, this compression introduces numerical characters into the message. The number of memory units needed to store each numerical character is equal to the value of the number. For example, 1 takes up 1 memory unit, 2 takes up 2 memory units, and 9 takes up 9 memory units.

Oddly, 0 takes up so little memory that it is treated as taking up 0 memory units.

For example:

ABCDEFGHIJ is 10 characters long, so it is compressed to A8J. After compression, it takes up 19 memory units.

OONNHHHHHANNNHHHHHHHH is 21 characters long, so it is compressed to OO17HH. After compression, it takes up 54 memory units.

BDGGGSCLUUVLCBBBQNUUUFFFFFXXXXXXXXX is 35 characters long, so it is compressed to BDG29XXX. After compression, it takes up 96 memory units.

For example, consider the same shorter message below:

NNBUSSSSSDSSZZZZMMMMMMMM PWAAASYBRRREEEEEEE FBBOFFFKDDDDDDDDD VJAANCPKKLZSSSSSSSSS NNNNNNBBVVVVVVVVV

The first line is compressed to NN20MM and now takes up 56 memory units. The second line is compressed to P16E and now takes up 28 memory units. After compression, the third line takes up 16 memory units, the fourth line takes up 77 memory units, and the fifth line takes up 42 memory units. So, the message will take up 219 memory units after applying this lossy compression scheme.

What is the number of memory units required to store your message on the aeolian transmitter if you compress the message using this lossy compression scheme?

Part 3

Difficulty Rating: 3

Thats a much smaller file size! However, as the compression scheme is lossy, some data will be lost after compression, so youll have to make sure the messages content is unaffected.

You produce a preview of the message on the aeolian transmitter… Oh dear, some parts of the messages contents were removed! It appears that lossy compression is unsuitable for this scenario.

Its alright though! Theres one lossless compression option that the transmitter supports.

This lossless compression scheme works by compressing each line separately, replacing consecutive runs of identical characters with frequency-value pairs. For example:

OONNHHHHHANNNHHHHHHHH is compressed to 2O2N5H1A3N8H. After compression, it takes up 81 memory units.

BDGGGSCLUUVLCBBBQNUUUFFFFFXXXXXXXXX is compressed to 1B1D3G1S1C1L2U1V1L1C3B1Q1N3U5F9X. After compression, it takes up 224 memory units.

Youll have to apply this lossless compression scheme to your message to decrease its file size.

For example, consider the same shorter message below:

NNBUSSSSSDSSZZZZMMMMMMMM PWAAASYBRRREEEEEEE FBBOFFFKDDDDDDDDD VJAANCPKKLZSSSSSSSSS NNNNNNBBVVVVVVVVV

The first line is compressed to 2N1B1U5S1D2S4Z8M and now takes up 142 memory units. The second line is compressed to 1P1W3A1S1Y1B3R7E and now takes up 127 memory units. After compression, the third line takes up 61 memory units, the fourth line takes up 154 memory units, and the fifth line takes up 55 memory units. So, the message will take up 539 memory units after applying this lossless compression scheme.

What is the number of memory units required to store your message on the aeolian transmitter if you compress the message using this lossless compression scheme?

Answers:

Part 1: 132305
Part 2: 27304
Part 3: 44282