[Community Puzzle] Assignments are boring

https://www.codingame.com/training/medium/assignments-are-boring

Send your feedback or ask for help here!

Created by @Crypticsy,validated by @Velcoro,@Scarlatine and @Backtomars.
If you have any issues, feel free to ping them.

I am wondering whether it is possible to solve this WITHOUT storing all the paper number of generated LCG numbers (pagecounts). I get out of memory error at the last IDE test while generating the LCG array even before my solver code section starts. But because of the modulo calculus, LCG is quite random so I need all of them at once in order to be able to have them in ascending order… Do I miss some idea here?

You’ve kind of answered that yourself, haven’t you?

1 Like

Yes, what would happen if you could find some pattern in the generated sequence ? :slight_smile:

Ah, I forgot that LCG is cyclic and the number of distinct values is much less than the 2^power here.
Thanks, now my code passes.

Remember there are other possibilities between “store all assignment lengths” and “exploit LCG periodicity”.

Can anyone give me the whole solution code in Python 3 of this puzzle? My brain is just about to boom.

No, we won’t.

I didn’t asked to you…

No but as moderator, my job is to answer you that we won’t (and that I will delete each solution posted here or elsewhere).

If you cannot solve it at all, it probably means that you’re not ready for it (yet).
Just try another puzzle then.

If you can partially solve it but still fail few testcases, you can ask for hints, but we won’t give more than hints.

Hello,

I finally managed to get the correct algorithm but the only issue preventing a full solving of the puzzle is related to time optimisation.

My algorithm works for all tests bar the last two.