Ad
  • Custom User Avatar

    M, changed to a single while loop just in case, though these while loops had O(sqrt(n)). After several attemts and combining factorials list with math function I got easy random tests and passed lol

  • Custom User Avatar

    Yeah, but I have tried to create a list of factorials from 0 to 1250, this should be enough for n and k ranges I see in logs. However, I get run out of time when find factorials with built-in math module function (and, what is more strange, I get is still, with getting factorials for o(1))
    I have some improvement in my mind, might help :)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    In the task it is said k <= 100, but it can be up to 1000. Not clear :(