I submitted the solution for CHEFSEG using log2() and pow() functions of math.h library file in C. But it gave WA.
When i replaced them with my own made functions, It showed AC.(although partial)
So is it not allowed to use standard library files (especially math.h) in long challenges?
math.h is allowed for C.
What I think is, problem must be with the return type of your functions and in-built functions.
In-built functions return double. Again there is some precision issues regarding double. That might be the problem in your case.
See this. The comment in line 40 demonstrates the reason. The
pow function may also cause a range error if the result is too great or too small to be represented by a value of the return type. pow in this doesn’t return the correct value but gives
inf if I try finding out for 2^10000 or more. Because of this, wherever in your code power exceeds the value, it starts giving erroneous results which gives you a wrong answer. Similarly, even your manual code is not working for larger values, but can be programmed to work if some mod condition etc is given.
Please, edit your post and add links to your solutions correctly. There’s nothing such that standard libraries are not allowed.
Sorry, It was my first question.
I have corrected the links.
@hitman__o_o We are here to help, The answer lies below…