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

Автор tejas10p, история, 4 года назад, По-английски

We invite you to participate in CodeChef’s Starters 71, this Wednesday, 28st December, rated for Divs 2, 3 & 4.

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!

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

»
4 года назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

Do codechef have any plans to bring cookoffs back in (near) future ?

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

problem Expected Sum:-

input:- 3 4 output:- 285212674 how??

i am trying to solve it on paper and i am getting (28/35). explain

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

Any hints on unique mode ?

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

Can someone tell me how ppl end up with same solutions? Also please someone tell if these 2 solutions will fall under plag?

I seriously want my rank 69, currently at 71 but if these 2 submissions are caught under plag then I might get rank 69. [Edit 1 : These 2 submissions have just a difference of 1 variable name change of array. He has matrix and other person has named it mat. That's all!! So I think it falls under plag since rest all things are same] Smh these weren't caught under plag.

https://www.codechef.com/viewsolution/83717025 https://www.codechef.com/viewsolution/83719372

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

How to solve expected sum?

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

    Solve it as if chef was picking (A+B+1)/2 cards. (That's whole number division, so 5/2 = 2), but ignore the fact that the card gets removed as it doesn't matter for the final answer.

    Let K=(A+B)/2. Then the expected value is K*A/(A+B)

»
4 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится
  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Sir, you wrote a dp solution for expected sum. Can you share it please. For 3, 4 how to calculate the output? Can you share code plz

    • »
      »
      »
      4 года назад, скрыть # ^ |
      ← Rev. 4  
      Проголосовать: нравится 0 Проголосовать: не нравится

      Other than dp, there exists a combinatorics solution too. Suppose, you want a score of $$$x$$$ at the end of game, so you have to choose $$$x$$$ times 1 and rest times 0. In a game of $$$n$$$ moves, you have total $$$t = \frac{n + 1}{2}$$$ moves, so the probability comes out to be:

      $$$ p(x) = \Large{\frac{{{a}\choose{x}} {{b}\choose{t - x}}}{{n}\choose{t}}} $$$

      So, to calculate expected moves, you need to compute the sum $$$\sum{x \cdot p(x)}$$$, which can be done in $$$\mathcal{O}(n)$$$ time.

      AC + RTE submission, though not WA.

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

      $$$dp[O][Z]$$$ denotes the expected first player will get if we start with $$$O$$$ ones and $$$Z$$$ zeros.

      Base cases -
      $$$dp[O][0] = (O+1)/2$$$, and
      $$$dp[0][Z]=0$$$

      First player will chose $$$0$$$ with probability $$$Z/(O+Z)$$$ and $$$1$$$ with probability $$$O/(O+Z)$$$.
      Therefore, $$$dp[O][Z-1]$$$ with be the expected value the second player will get with the probability $$$Z/(O+Z)$$$, $$$dp[O-1][Z]$$$ with probability $$$O/(O+Z)$$$.

      We also know that since the sum of the expected values of both players is $$$O$$$. Hence,
      $$$dp[O][Z]=O-dp[O][Z-1]*Z/(O+Z)-dp[O-1][Z]*O/(O+Z)$$$

      To get these values as fractions, I have used fractions lib in python
      Overall, it's an $$$O(O*Z)$$$ solution, I have used it to print values and guess the formula.