Challenge 15 - The internsheep
Here, at Better Farm Systems™, we're cloning our livestock in hopes to maintain our supply while also reducing the environmental impact.
In order to obtain the best, and only the best animals, we use advanced DNA editing techniques like CRISPR.
Since the DNA sequence is quite large, we use its crc32 hash in our logs and reports,
and I'm the scientist responsible for calculating it.
However, I'm tired of calculating the crc32 by hand, I'm fed up and I'm quitting right now.
As the intern, this task is now yours. By the way, you can use the calculator on my desk, I already submitted the easier ones :)
You have the clear DNA files in this archive.
You get a sequence of modifications:
Each modification starts with a line that has the name of an animal file and the number of additions. Each addition is on its own line with the form
Position is where the byte is going to be inserted, it can range from 0 (at the beginning of the file), to the size of the file (at the end of the file). Bear in mind that the file size increases with the additions.
Each animal file appears at most once in the input.
For each addition, the output is the string "File AdditionNumber: CRC32", where File is the name
of the file where all the additions are being performed, AdditionNumber is the index of the Addition
starting at 1 and the CRC32 is the crc32 of the whole file with the additions up to that time.
You must also include the CRC32 of the file without additions too (with AdditionNumber as 0).
Do not pad AdditionNumber, The CRC32 hash is a lowercase 8-char hex string.
1 <= Additions <= 4 for test 1 <= Additions <= 64 for submit 0 <= Position <= File size up to that addition 0 <= Byte <= 255
aardwolf0000 2 0 224 0 192 admiral0000 4 1 227 2 232 2 46 0 169
Explanation of the input:
aardwolf0000 is an empty file, so its crc32 is 00000000
Then you add the byte 224 (xE0) at the beginning of the file and the crc of the new file (xE0) is 72080df5
Then you add the byte 192 (xC0) at the beginning of the file and the crc of the file (xC0E0) turns out to be 2a2927c9
aardwolf0000 0: 00000000 aardwolf0000 1: 72080df5 aardwolf0000 2: 2a2927c9 admiral0000 0: d202ef8d admiral0000 1: 78daa13d admiral0000 2: 24c31377 admiral0000 3: 2f36d283 admiral0000 4: b5670765
Test your code
You can test your program against both the input provided in the test phase and the input provided in the submit phase. A nice output will tell you if your program got the right solution or not. You can try as many times as you want. Be careful with extra whitespace. The output should be exactly as described.
Test your program against the input provided in the test phase
Test your program against the input provided in the submit phase
During the submit phase, in some problems, we might give your program harder inputs. As with the test token, a nice output will tell you if your program got the right solution or not. You can try as many times as you need.
In the actual contest you have to solve the test phase before you can submit your code. You must provide the source code used to solve the challenge and you can only make one submission. After your solution is submitted, you won't be able to modify it to fix issues or make it faster.
If you have any doubts, please see the info section.
min: 2:37:47 h
10th percentile: 5:44:47 h
90th percentile: 30:12:05 h
max: 83:40:57 h
|Test phase time:||
10th percentile: 3:10:04 h
90th percentile: 24:55:55 h
|Submit phase time:||
10th percentile: 0:07:27 h
90th percentile: 17:20:38 h
|# of completions:||59|