D - Binomial Coefficient is Fun
-
Thoughts.
- With N=2000, O(N^2) would be fine.
- With M=10^9, it seems impossible to do dynamic programming like βthe first one is x and the rest are M-xβ.
- Viewing field hockey stick identity β Looks different
- If B is smaller than A, it is zero and can be ignored.
- Distribute the remaining among 2000 boxes
- Since there are about of individual events, they cannot be calculated individually and added together in time.
- β should be able to be bundled and calculated by some formula transformation.
- View [binomial coefficient formula
- Vandermondeβs identity
-
- Itβs a product of binomial coefficients into a single binomial coefficient, which is close to the objective.
- Adding a lower value is also close to the objective of being constant
- Cannot be used directly because the value above changes.
- There must be a formula like a variant of this β letβs find it.
- Write a code to naively calculate that you want to get and observe
:
| 1 | 1 | 1 | 4 | 4C1 |
| β | β | β | β | β |
| 1 | 1 | 2 | 10 | 5C2 |
| 1 | 1 | 3 | 20 | 6C3 |
- β
- In the case of Section 3.
- generally
-
- This is a mistake see addendum A
- Calculating sample 1 with this formula gave 8, but I doubt it because of the messy calculations along the way.
- Iβm supposed to have to come up with all the patterns below R, and Iβm using the formula R=1.
- In the first place, R can be about 10^9, so it seems impossible to calculate the binomial coefficient?
- This is a mistake see addendum B
-
Official Explanation
-
as is the answer
-
Since R=M-S
-
Why does this happen?
- The official explanation in natural language is, in essence, the following formula
-
Postscript B
- Calculation of binomial coefficients
- I tend to do βcreate a binomial coefficient table for faster calculationβ.
- I made a libraryβ¦
- But when the upper binomial coefficient is 10^9 and the lower is 10^6, as in this case, we should have used .
- This calculation can be done for O(m), so
- Faster than creating a table of size n
-
Postscript A
- generally
-
- This is an error.
- is correct
- so
- Oh, that one doesnβt fitβ¦
- so
- This formula only calculates the case where the βvalue to be assignedβ is exactly R
- The value we want is
- Use field hockey stick identity.
- This increases by 1, and the value we seek is .
- Now we come down to the same formula as in the official explanation.
-
-
β Explanation AC
- formal power series and can be solved by attributing to
- ARC110D_FPS
-
- https://twitter.com/yuruhiya/status/1335222719160315904?s=21
- This time I was judging it by the naked eye, but when I was done, I used OEIS and it was a breeze, so Iβll do that next time.
-
A path that does not involve βpredicting general terms from experimentally constructed sequences.β - I could transform the equation by interpreting it as Collapsing Duplicate Combinations.
- Sort by: ARC110D_nonFPS.
from ARC110
This page is auto-translated from /nishio/ARC110D using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. Iβm very happy to spread my thought to non-Japanese readers.