Ad
  • Custom User Avatar

    Unnecessarily high time complexity O(n^2)

  • Custom User Avatar

    Edited.

  • Custom User Avatar

    Edited.

  • Custom User Avatar

    Actually, due to the differences in the input range, the solutions (at least mine) to these two problems completely differ, and each solution is not strictly better than the other. As you see, the L and m (the size of the alphabet) in Ver 1 is greater than those in Ver 2, but in Ver 2 n is greater than in Ver 1 instead -- so I don't think they duplicate.

  • Custom User Avatar

    Thanks for correcting me and sorry for my poor English. And IMHO, I think the following statement might be clearer:

    Formally, since the probability can always be represented as a rational number p/q, you need to return (q^-1) * p % 998244353, where q^-1 represents the multiplicative inverse of q (modulo 998244353).

    How do you think about it?

  • Custom User Avatar

    Well I'm closing the issue...

  • Custom User Avatar

    Thanks for pointing it out.

  • Custom User Avatar

    @B1ts he means "A positive integer with no leading zeros and a difference of at least two between adjacent digits is called a yuyuggg number.". For example, 24 is a yuyuggg number since the absolute value of (2-4) is 2, which is bigger or equal to 2 mentioned in description, while 34 is not. For edge cases, a number with a single digit is also a yuyuggg number.

  • Custom User Avatar

    Almost trash kata...

    First of all, your test cases are wrong. You should look into your code and find that you should write

    part(l - 1); ll minn = ans;
    part(r); ll maxx = ans;
    return maxx - minn;
    

    instead of

    part(l); ll minn = ans;
    part(r - 1); ll maxx = ans;
    return maxx - minn;
    

    Secondly, your code can obviously cause undefined behaviors at

    if(!limit&&dp[pos][pre]!=-1) return dp[pos][pre];//没有最高位限制,已经搜过了
    

    since pre can be a negative number (-2) when accessing the array. With this simple test case it can be easily reproduced: 10 10.

    Thirdly, avoid commenting with native language since it doesn't help people except those in your country understand anything.

    Lastly, your test cases are written in a really bad manner. Answers should be evaluated INSIDE the It block, but not out of it. And, since warriors could see their programs' output during the test, you should add some random tests to avoid programs with pre-calculated answers from passing the tests. Your example test cases cannot even get compiled successfully!

    BTW, there're some minor mistakes in your kata description. I think you mean "A positive integer with no leading zeros and a difference of at least between two adjacent numbers is called a yuyuggg number.". And "a" and "B" in the later part of the description should be in the same case.

  • Custom User Avatar

    Well, I don't understand Haskell and the translation is contributed by @JohanWiltink... But maybe I can check his JS code and find his mistake.

  • Custom User Avatar

    Sorry but... I didn't ever realize that solvers are able to print some debug info during tests...

  • Custom User Avatar

    Sorry for that... And the problem is changed now.

  • Custom User Avatar

    Well, what the problem is asking is exactly the distance between two points, but I made it become (the minimum time * 2) so that the problem is partly close to the plot. However, as you think it's kind of midleading since units of time not divisible, we'm to edit it later ;)

  • Custom User Avatar

    Okay, pardon me for my carelessness. I didn't realize that you can view my final tests so i assumed that you were talking about example tests. It's fixed now.

  • Custom User Avatar

    Actually if you look carefully it should be:

    Assert::That(time_needed(point(0, 0), point(1, 0)), Equals(1));
    

    maybe you edited the example tests by accident?

  • Loading more items...