41 - Maximum Encyclopedia Overhang

Back to Topic List

aszaloki     2024-10-02 09:19:38

Hi Kevin,

the test input data field is empty, although the checker has exact expected answers. Could you please populate it?

Thanks!

admin (Kevin)     2024-10-02 16:01:53
User avatar

Hi Adam! Sorry about that, the testcases should be displaying properly now!

aszaloki     2024-10-02 18:33:37

Thank you Kevin!

I have one more note. I use double type (which has 15-17 digit precision) for calculating the harmonic series (H(n)). For very large numbor of n I use the Euler-Mascheroni constant (gamma) for the approximation of H(n) lim(H(n)) -> ln(n) + gamma

For the expected answers my results differ in the last (8th) decimal digit. I tried truncation and rounding as well but there are always a few inputs which differ.

Maybe the issue is the same as we saw in other problems when the checker was not so permissive :) Could you please look into this?

Thank you in advance!

admin (Kevin)     2024-10-03 11:07:59
User avatar

Hi Adam!

My first thoughts - even though 8 digits are being reported in the expected answer, the actual checker for this problem does perform a comparison between submitted answers and expected ones to verify that the differences between each pair is less than 1e-6, using those differences to determine pass/fail :)

However looking at your code I believe I see the potential issue - the approximation you're referring to decreases its error as n increases, and as it stands it looks like for the lowest value of n allowed to use that method in your code will still yield error greater than 1e-6.

As an alternative to the straightforward fix (which should actually be sufficient here), there are also options to add correction terms to that approximation so that it is accurate to 1e-6 starting at much smaller values of n... but that option shouldn't be strictly necessary here :)

aszaloki     2024-10-03 14:06:43

Ok, I increased the lower bound where the approximation should take place. My solution is accepted now. Thanks.:)

Please login and solve 5 problems to be able to post at forum