O--O's blog

By O--O, history, 2 years ago, In English

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!

  • Vote: I like it
  • +32
  • Vote: I do not like it

| Write comment?
»
2 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Contest starts...

»
2 years ago, # |
  Vote: I like it -10 Vote: I do not like it

Is it rated?

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
2 years ago, # |
  Vote: I like it +25 Vote: I do not like it

Did you like the contest?

  • »
    »
    2 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    yes, but I've met the third task here

  • »
    »
    2 years ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

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

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it -13 Vote: I do not like it

      What do you mean? The time limit seemed reasonable

      • »
        »
        »
        »
        2 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        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.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

How to solve last problem

  • »
    »
    2 years ago, # ^ |
    Rev. 6   Vote: I like it 0 Vote: I do not like it

    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)

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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$$$.

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Short and sweet contest :)

»
2 years ago, # |
  Vote: I like it -32 Vote: I do not like it

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

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

make this comment most disliked on codeforces

»
2 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

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

»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    23 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.