satyam343's blog

By satyam343, 2 years ago, In English

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:

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!

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

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

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

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

Some questions appear to be simple, but they are not.

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

How to do MINABS?

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

    Simply follow greedy approach for all pairs of characters, checking whether it would be feasible to shift A[i] or B[i].

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

How to do DISTNEIGH ?

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

    The editorial is available here.

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

    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

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

nice problems

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

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)?

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

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.

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

    whereas bottom up worked, which is weird

    it's not weird, definitely bottom up is faster !

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

      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.

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

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

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

It was a nice round