We invite you to participate in CodeChef’s Starters 63, this Wednesday, 2nd November, rated till 6-stars Coders (ie. for users with rating < 2500).
Time: 8 PM — 11:00 PM IST
Joining us on the problem setting panel are:
- Contest Admins:Nishank IceKnight1093 Suresh, Satyam satyam343 Kumar Roy
- Setters:Nishank IceKnight1093 Suresh, Satyam satyam343 Kumar Roy, Arun Arun_bro1 Sharma, Ram grayhathacker Gopal Pandey
- Testers: Utkarsh Utkarsh.25dec Gupta, Takuki tabr Kurokawa
- Statement Verifier: Nishank IceKnight1093 Suresh
- Video Editorialists: Sundar K Letscode_sundar, Garvit garvitvirmani0 Virmani, Vibhu Vibhubhatia Bhatia, Madhav jhamadhav Jha, Suraj jhasuraj01 Jha, Jwala jwalapc , Rohit ezo_tihor Oze, Adhish ak2006 Kancharla
- Text Editorialists:Nishank IceKnight1093 Suresh
Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest.
The video editorials of the problems will be available for all users for 1 day as soon as the contest ends, after which they will be available only to Pro users.
Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.
Hope to see you participating. Good Luck!
Auto comment: topic has been updated by satyam343 (previous revision, new revision, compare).
Some questions appear to be simple, but they are not.
How to do MINABS?
Simply follow greedy approach for all pairs of characters, checking whether it would be feasible to shift A[i] or B[i].
How to do
DISTNEIGH
?The editorial is available here.
I solved it with slightly different method than the editorial. The idea is to imagine the array with all $$$3's$$$ removed. There would be blocks of $$$1's$$$ and $$$2's$$$. Since $$$a[1] = 1$$$ and $$$a[n] = 1$$$, the array would look like this: $$$11..1 \; 22..2 \; 11..1 \; 22..2 \; 11..1$$$. Clearly no. of blocks will be odd with alternating $$$1's$$$ and $$$2's$$$. Now imagine adding $$$3's$$$. To "fix" a block of size $$$s$$$ you need to use $$$3$$$ exactly $$$s-1$$$ times. For example, to fix $$$11111$$$ you need to use $$$3$$$ four times (to get $$$131313131$$$).
So, if there are $$$k$$$ blocks, you require at least $$$x+y-k$$$ threes to fix, Now there are additional $$$(n-x-y ) - (x+y-k)$$$ threes left, there are also $$$k-1$$$ borders between $$$1's$$$ and $$$2's$$$ in which we have to insert these additional $$$3's$$$. So, we gotta select $$$(n+k-2x-2y)$$$ spaces among total of $$$k-1$$$ spaces. There are $$$\binom{k-1}{n+k-2x-2y}$$$ ways to do so!
Now, to form blocks, note that total size of blocks of $$$1's$$$ is exactly $$$x$$$, let $$$w_{i}$$$ be the length of the $$$i^{th}$$$ block of $$$1's$$$. Also, there are $$$ceil(k/2)$$$ blocks of $$$1's$$$ and $$$floor(k/2)$$$ blocks of $$$2's$$$ We need to find positive integral solutions of —
$$$w_{1} + w_{2}...+w_{ceil(k/2)} = x$$$. This is simply, $$$\binom{x-1}{ceil(k/2)-1}$$$. Similar result for no. of ways of making blocks of $$$2's$$$ is $$$\binom{y-1}{floor(k/2)-1}$$$.
So finally the answer would be to sum $$$\binom{x-1}{ceil(k/2)-1}\binom{y-1}{floor(k/2)-1}\binom{k-1}{n+k-2x-2y} $$$ for all odd $$$k$$$ from $$$1$$$ to $$$n$$$.
Link for my submission: https://www.codechef.com/viewsolution/78976625
nice problems
Distinct neighbours was really nice! Is it me or the stakes seem really low in Codechef after the change in rating calculation (especially in div1)?
For GREEDGRID, my straight forward top down approach gave TLE for 2 tests whereas bottom up worked, which is weird. I think the constraints should be lower or time limit should be higher, Here is the submission: https://www.codechef.com/viewsolution/78948353
Please take this into consideration from future contests.
whereas bottom up worked, which is weird
it's not weird, definitely bottom up is faster !
Yes, obviously, what I am trying to say is that constraints & time limits should be given taking all these things into consideration, Such things don't happen on other platforms.
Looks like many people skipped out after seeing Div2 A is too hard, the same thing is happening on Codechef, lol. Only 1.3k people submitted to div2, usually it’s >2k
It was a nice round