Блог пользователя satyam343

Автор satyam343, 2 года назад, По-английски

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!

  • Проголосовать: нравится
  • +45
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится +27 Проголосовать: не нравится

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

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to do MINABS?

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to do DISTNEIGH ?

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +11 Проголосовать: не нравится

    The editorial is available here.

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    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 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

nice problems

»
2 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    whereas bottom up worked, which is weird

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

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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 года назад, # |
  Проголосовать: нравится +22 Проголосовать: не нравится

It was a nice round