yash_daga's blog

By yash_daga, history, 18 months ago, In English

We invite you to participate in CodeChef’s Starters 95, this Wednesday, 21st June, rated till 6-stars Coders (ie. for users with rating < 2500).

Time: 8:00 PM — 10:00 PM IST

Note that the duration is 2 hours. Read about the recent CodeChef changes here.

Joining us on the problem setting panel are:

Note: Some problems have subtasks

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
  • +63
  • Vote: I do not like it

| Write comment?
»
18 months ago, # |
Rev. 2   Vote: I like it +18 Vote: I do not like it

There is a typing mistake in the post. The date should be 21st June

»
18 months ago, # |
  Vote: I like it +7 Vote: I do not like it

yash_daga sir orz !..

»
18 months ago, # |
  Vote: I like it +3 Vote: I do not like it

AST_TheCoder kopsss bro

»
18 months ago, # |
  Vote: I like it +18 Vote: I do not like it
Wednesday
»
18 months ago, # |
  Vote: I like it +11 Vote: I do not like it

Contest starts in 30 minutes!

»
18 months ago, # |
  Vote: I like it +18 Vote: I do not like it

There is a mistake in Transfusion Chain problem.
Blood type O donors can also donate to recipients with blood types O, according to the test cases, but it is not mentioned in the statement.

  • »
    »
    18 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    got two penalities due to this mistake if o is only for a,b,ab then i can use o only once at the start i think if in a running contest if some issue occurs due problem setters then all the penalties should not be counted on those problems

    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it +13 Vote: I do not like it

      I don't think you get penalties in Starters anyway.

      • »
        »
        »
        »
        18 months ago, # ^ |
        Rev. 9   Vote: I like it -8 Vote: I do not like it
        • Mistake 1: Transfusion Chain Quesion, Don't we get penalties on submission time, as this announcement pop up after 1 Hour of completion of Contest, and Don't it disturbs your mind set of giving the Contest, as I am thinking for mistake in my logic in first question, for more than 20 minutes just because of their rubbish mistake, and the interesting part was that I was shocked to see more than 2000+ Accepted Submissions on that Problem in Div 2.
        • Mistake 2: In Partition and Maximize Question, the Equation firstly was max(l[i], l[i+1], l[i+2], ..., r[i]) till more than 1 Hour of the Contest, and after 1 Hour of the Contest, without any Announcement it get's written as max(l[i], l[i]+1, l[i]+2, ..., r[i]), Am I wrong Problem Setter's and Tester's yash_daga wuhudsm ?
        • Isn't this Contest was tested before announcement, If it is tested, then what were the tester's doing ?
        • Also almost all the three below Question's were on Expected Value, This is not definition of Balanced Contest BTW...
        • Updated:- I am sorry, from my point of view, I think the Contest was very Good overall, Some fault's can happen as we all are Human, But I can say the Problem's were very Interesting to upsolve...

        • »
          »
          »
          »
          »
          18 months ago, # ^ |
            Vote: I like it +27 Vote: I do not like it
          • We're sorry about this, but the statement was rectified within 10 minutes and a announcement along with pop-up was made at 20:17
          • This is a small latex error which I don't think affected anyone, it's obvious from the partitions mentioned in the statement what the author wants to convey.
          • I feel Break Array is more of a dp problem along with prefix sum optimisation, than a probability problem.
        • »
          »
          »
          »
          »
          18 months ago, # ^ |
            Vote: I like it +22 Vote: I do not like it

          who reads the entire easy problem in contests . people probably went with the flow in transfusion chain

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

In the second testcase of ARRAY_BREAK, if the arr is [1], then after applying any operation will it include the expected sum?

Like it will be (sum+1)/(cnt+1) or sum/cnt(unaffected by this)?

  • »
    »
    18 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If at any point the size of the array becomes one, then for all further operations, it will remain unchanged.

»
18 months ago, # |
  Vote: I like it +7 Vote: I do not like it

name it a probability(math) contest rather than a dsa or cp contest

»
18 months ago, # |
  Vote: I like it +10 Vote: I do not like it

MathChef :/

»
18 months ago, # |
  Vote: I like it +3 Vote: I do not like it

My O(K*N^2) submission is getting TLE on problem "Break this array".Runtime is too strict.

  • »
    »
    18 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think you are doing lots of power operation

  • »
    »
    18 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Does your solution has an extra factor of log(MOD) due to modular division?

    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      This is the submission -Link.It doesn't have extra log factor.

      • »
        »
        »
        »
        18 months ago, # ^ |
        Rev. 2   Vote: I like it +9 Vote: I do not like it

        when you have too many modulo operations it is better to store the modulo in a const variable, doing this makes your solution run in 0.7s

»
18 months ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

3 probability problem in a contest.. wth admin (:
also rating system skip the last contest rating which show on right side of problemset page, plz look at that.

»
18 months ago, # |
  Vote: I like it +7 Vote: I do not like it

How were people able to solve TRANCHAIN without even considering "blood group O can donate to O as well"?

I wasted the first 30 minutes on the first problem due to this typo.

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +22 Vote: I do not like it

    Ig many had studied biology in their lower grades . They went with the fact.

»
18 months ago, # |
Rev. 2   Vote: I like it +4 Vote: I do not like it

Constraints of Guess game say that N >= 2 but for the first subtask it is N >= 1. How do you define the expectation when N == 1?

Unfortunately I just wrote my full solution to that but can't submit. Please allow practice mode.

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    I think Kira_1234 got 60 points due to this. His full solution does not pass the first subtask because it has a testcase with N == 1

    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it +23 Vote: I do not like it

      Thanks a lot for pointing this error out. I did not notice this and was wondering for the last hour what the issue in my code was.

  • »
    »
    18 months ago, # ^ |
      Vote: I like it +25 Vote: I do not like it

    Hey, sorry about this, the solutions have been rejudged after removing the n==1 case. 2 submissions were affected due to this.

»
18 months ago, # |
  Vote: I like it +24 Vote: I do not like it

i was getting 31/7 for the second sample test case in the problem break this array which equals 428571436 modulo 1e9+7. Can explain me what is the actual ans to it ?

  • »
    »
    18 months ago, # ^ |
    Rev. 2   Vote: I like it +12 Vote: I do not like it

    It is 41/12, the resulting arrays you get are not equiprobable, you can make a probability tree and get this result.

    Spoiler
    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      I see now, actually the probabilities were not completely independent for each stage, it had to be cumulated. The problem statement was a little unclear about this fact, i just assumed the process to be independent at each stage from the previous stages.

      Thanks for the clarification.

»
18 months ago, # |
  Vote: I like it +23 Vote: I do not like it

Thanks for the Contest. Though it was a bit math-heavy, I learned something new today.

»
18 months ago, # |
  Vote: I like it +13 Vote: I do not like it

Probability — GCD combination question was really very good.

»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Can anyone explain me 2nd test case of ARRAY_BREAK?

  • »
    »
    18 months ago, # ^ |
    Rev. 2   Vote: I like it +41 Vote: I do not like it

    Since lots of people have trouble in understanding this, here's a probability tree explaining it.

    Spoiler
    • »
      »
      »
      18 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i was able to get the total sum and number of possible partitions possible using dp with an algorithm of o(n^3*k) and seeing the explanation of the first test case, i thought maybe it's just the modular division of both but it was certainly a lot more than that, anyways it was my first time experiencing expected values problems.

»
18 months ago, # |
Rev. 2   Vote: I like it +12 Vote: I do not like it

Similar Question for Chef and Moves of GCD: Link

My submission: Link

»
18 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Guess Game could also be simply done in O($$$NloglogN + T\sqrt{N}$$$). If we fix the small number $$$d$$$, the large number can have $$$\lfloor\frac{n}{d}\rfloor-1$$$ values. Also since the answer only depends on $$$d$$$, we can find the range of $$$d$$$ for which $$$\lfloor\frac{n}{d}\rfloor$$$ is constant and add their contribution to answer. It is well known that there are $$$O(\sqrt{n})$$$ distinct ranges.

»
18 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

In Question BREAK THE ARRAY I Dont Know where my code is bugging can anyone please figure it out. It is not able to run even in lower limits of 100 Yet other peoples have did the similar and got AC sub link :- https://www.codechef.com/viewsolution/98819410

»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

There is an $$$O(n)$$$ solution to PARTITION without using segment trees. Consider the $$$O(n^2)$$$ dp

Naive DP

Transitions can be maintained using monotonic stack.

Efficient DP
  • »
    »
    18 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    Can you explain this?

»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

can someone tell what's wrong in my solution for subtask1 of "Break This Array", soln

»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I guess there is a problem while viewing solutions of some participants, can you please look into it. Example of one such user's submission

»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

For Problem CAMOG, the editorial says. " We do the $$$2^k$$$ operation for each pair of (number, divisor) below $$$N$$$. It’s well-known that there are $$$\mathcal{O}(N\log N)$$$ such pairs, so a simple upper bound on complexity is $$$\mathcal{O}(2^6 \cdot N\log N)$$$. "

Could you explain why is the number of pairs $$$\mathcal{O}(N\log N)$$$ , I was thinking that it should be something like $$$\Sigma$$$ $$$x^{1/3}$$$. I read somewhere that $$$N^{1/3}$$$ is a good upperbound for the number of divisors.