### maroonrk's blog

By maroonrk, history, 4 months ago,

We will hold AtCoder Regular Contest 156.

The point values will be 400-500-600-700-800-1000.

We are looking forward to your participation!

• +128

 » 4 months ago, # |   +23 I hope the problems of this contest have fewer corner cases.
•  » » 4 months ago, # ^ |   +21 Narrator: Alas, crazy_sea was wrong.
•  » » » 4 months ago, # ^ | ← Rev. 2 →   +3 A had edge cases, B and C didn't have any.
 » 4 months ago, # |   -97 trash round
 » 4 months ago, # |   +46 Amazing round.
 » 4 months ago, # |   +3 hope everyone get good rating
 » 4 months ago, # |   0 Amazing round.
 » 4 months ago, # |   +28 cpp 20 when
 » 4 months ago, # |   +7 Good luck! (I still have $+\infty$ homework)
 » 4 months ago, # |   0 !!!
 » 4 months ago, # |   -6 Amazing round.
 » 4 months ago, # |   +47 Thank you for the contest! Today I learned that Lucas's theorem works for multinomial coefficients too. Why in the first two problems N is large but for some reason in the third one it’s small? I was doubting whether my linear solution was correct for a long time…
•  » » 4 months ago, # ^ |   +77 Probably you can not write checker in O(N) for the third?
•  » » 4 months ago, # ^ |   +16 2: Maybe it's because of the checker complexity.
•  » » 4 months ago, # ^ |   +67 I believe the checker for C is not easy when $N$ is large. (In fact, it's not obvious even for $O(N^2)$ time.)
•  » » 4 months ago, # ^ |   +8 My solution of C is $O(n^2)$.
 » 4 months ago, # |   +3 How to solve the problem B?
•  » » 4 months ago, # ^ |   0 Hint 1:Think in terms of mex of final multiset. Hint 2:How can you relate it to the stars and bars concept ?
•  » » 4 months ago, # ^ |   +6 Assume, the mex of the final set is $x$. In this case, all numbers less than $x$ are in set. The ones, that are not, have to be added. Assume, we added $y$ of such numbers.Now, we have to add $k - y$ more numbers. These are numbers from $0$ to $x - 1$. We are counting number of sets, so we have to "find number of non-decreasing arrays of length $k - y$ with elements from $0$ to $x - 1$". Now, not easy combinatorial step: we have to put $x - 1$ stages into $k - y + 1$ positions. This is number of "combinations with repetitions": $C_R(k - y + 1, x - 1)$. Rewrite as usual combinations: $C_R(a, b) = C(a + b - 1, a)$.
 » 4 months ago, # |   +6 How to solve C ?
•  » » 4 months ago, # ^ |   +26 For an $x$, define $q_x$ as the number such that $p_{q_x}=x$.The minimum similarity has to be at least 1, as one can choose path $(x,q_x)$ to make it 1. So consider constructing a permutation that makes the answer 1.Let's consider a leaf $x$. If this node makes a contribution of 1 to the final answer, than the final path must contain path $(x,q_x)$. As $x$ is a leaf, $x$ will be the first element in the LCS. Then we only need to ensure that there is no other same element after $q_x$. One simple way to do this is to make $q_x$ the leaf. Then we get the idea to shuffle the indexes of the leaves. It's not hard to prove that if we do this, any LCS with a leaf will have length of at most 1.Then return to the original problem. Note that since leaves will not make any further contribution, we can simply delete them and do the same thing on the resulting tree again and again, until there's only 0/1 nodes left. Then we can do some trivial assignments and the whole process is finished. It can be proved that in this case, the answer is at most 1, which is obviously the best answer we can get.
 » 4 months ago, # | ← Rev. 2 →   +3 INF corner cases in AB was good problem
•  » » 4 months ago, # ^ |   0
•  » » » 4 months ago, # ^ | ← Rev. 2 →   +3 3 3 011 4 0110 5 00110 The output is supposed to be -1 3 2 
•  » » » » 4 months ago, # ^ |   0 thanks!i'm really dumb
•  » » » » » 4 months ago, # ^ |   0 Sorry, there was a mistake in the output, just fixed it. TC 3 in my input seems fine in your code.
•  » » » » » » 4 months ago, # ^ |   0 yeah but i got my mistake thanks again.
 » 4 months ago, # |   +1 anybody cares to explain problem B question not solution ?
 » 4 months ago, # |   +20
•  » » 4 months ago, # ^ |   0 :) Видео недоступно Оно содержит материалы партнера SME. Он заблокировал ролик в вашей стране из-за нарушения авторских прав.
•  » » » 4 months ago, # ^ |   0 use VPN then
•  » » 4 months ago, # ^ |   0 Did u find a test case on problem F where your code dosen t work, because i had WA on the same tests an was wondering where the mistake could be.
•  » » » 4 months ago, # ^ |   +13 It doesn't work on the second sample. I need to choose which elements to delete in trees more carefully, I don't yet know how exactly.
•  » » 3 months ago, # ^ |   0 Hi, is there a name for dp code in D? Is it some kind of trick for powers of 2?
•  » » » 3 months ago, # ^ |   0 The dp itself is ad-hoc here, it's not something standard. If you want to categorize it, I would say it is similar to knapsack, but it's not just textbook.The idea of the whole solution is from Lucas's theorem. I think that my solution is the same as the one in the editorial.
•  » » » » 3 months ago, # ^ |   0 I read the editorial and understood the first part. And that we need to do a weird knapsack on 60 bits. But the dp itself is not obvious
 » 4 months ago, # |   +11 Linear time solution to E. It's nothing inspiring compared to a quadratic time solution, just beating up the quadratic code till it falls in place.
 » 3 months ago, # |   0 How does the computing of inverses modulo MOD work in this editorial precomputation? inv.append(-inv[MOD % i] * (MOD // i) % MOD) Where does this equation inv(x) mod MOD = -inv(MOD mod x) * floor(MOD/x) mod MOD come from?
•  » » 3 months ago, # ^ |   0
 » 3 months ago, # | ← Rev. 3 →   -19 A, B and C are easy. UPD: Just a joke, why so many downvotes :-}
 » 3 months ago, # |   0 Could anyone explain the editorial solution for problem D? It would be of great help...
 » 3 months ago, # |   0 Why the problem F can be solve in $O(n\sqrt{n})$ time.