Блог пользователя O--O

Автор O--O, история, 20 месяцев назад, По-английски

Hello, Codeforces!

I am the writer of the problems.

This blog is invitation to SpecialForces

Previous contest: Mathforces

You will have 5 problems in 120 minutes.

Please register and join the contest.

I bet you will like the contest.

Best of luck for everyone!

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

»
20 месяцев назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Contest starts...

»
20 месяцев назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

Is it rated?

»
20 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by O--O (previous revision, new revision, compare).

»
20 месяцев назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

Did you like the contest?

  • »
    »
    20 месяцев назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    yes, but I've met the third task here

  • »
    »
    20 месяцев назад, # ^ |
      Проголосовать: нравится +16 Проголосовать: не нравится

    In B 1000ms TL and input of 1e6 which is too much for scripting languages to read.

    • »
      »
      »
      20 месяцев назад, # ^ |
        Проголосовать: нравится -13 Проголосовать: не нравится

      What do you mean? The time limit seemed reasonable

      • »
        »
        »
        »
        20 месяцев назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        I think it is possible to make constraints weaker so that it still surely doesn't allow to pass inefficient solutions. The problems is that scripting languages (e.g. Perl) can't even read 1e6 numbers in 1000 ms. I think usually it is OK 5e5 and 2 sec TL, or 1e6 and 4 sec TL.

»
20 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve last problem

  • »
    »
    20 месяцев назад, # ^ |
    Rev. 6   Проголосовать: нравится 0 Проголосовать: не нравится

    Let $$$e(p)$$$ be exponent of prime $$$p$$$ in $$$f(x)$$$, where $$$f(x) = 1! * 2! * 3! ... * x!$$$.

    Imagine extracting out single $$$p$$$ from $$$p! , (2p)!, (3p)! ...((x/p)p)!$$$ from $$$f(x)$$$, this would contribute: $$$(x/p)(x+1) - p(x/p)((x/p) + 1)/2$$$ powers of $$$p$$$.

    But still you can extract $$$p's$$$ from $$$p^{2}!, (2p^{2})!, (3p^{2})! ...((x/p^{2})p^{2})!$$$, this would contribute: $$$(x/p^{2})(x+1) - p^{2}(x/p^{2})((x/p^{2}) + 1)/2$$$ powers of $$$p$$$.

    Again you can extract more $$$p's$$$ from $$$p^{3}!, (2p^{3})!, (3p^{3})! ...((x/p^{3})p^{3})!$$$, this would contribute: $$$(x/p^{3})(x+1) - p^{3}(x/p^{3})((x/p^{3}) + 1)/2$$$ powers of $$$p$$$.

    And so on..

    So, you gotta continue summing up till $$$\lceil log_{p}(1e^{9}) \rceil$$$ iterations. That's pretty small!

    Complexity: $$$O(t\lceil log_{5}N \rceil)$$$, where $$$t$$$ are no. of testcases.

    Answer will be the exponent of $$$5$$$ in $$$f(x)$$$. (Of course)

    • »
      »
      »
      20 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Hi please can you explain more about contribution part? I am unable to get how you got that formula.

  • »
    »
    20 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Highest power of a prime $$$p$$$ which divides $$$n!$$$ is $$$\frac{n - sum(n)}{p - 1}$$$. Here $$$sum(n)$$$ is the sum of digits of $$$n$$$ in base $$$p$$$. You need to find the summation of this over $$$[a,b]$$$ for $$$p = 5$$$.

»
20 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Short and sweet contest :)

»
20 месяцев назад, # |
  Проголосовать: нравится -32 Проголосовать: не нравится

Did C's intended solution use Binary Exponentiation or the Pisano Period? The latter seems much more elegant to me.

»
20 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

make this comment most disliked on codeforces

»
19 месяцев назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

D can be solved in $$$O(n)$$$ time obviously.

»
19 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Writing the comment to save the post so I can give the contest later

  • »
    »
    17 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    There is a "star" symbol next to the upvote/downvote. By clicking on it the blog will be added to your favorite blogs and can be viewed later from the favorites tab in ur profile.