yashChandnani's blog

By yashChandnani, history, 13 months ago, In English

We invite you to participate in CodeChef’s August Lunchtime, this Saturday, 29th August, from 7:30 pm to 10:30 pm IST.

The contest features 6 problems and is 3 hours long.

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.

Joining me on the problem setting panel are:

  • Setters: Rithvik Chatterjee, Ritesh rishup132 Gupta, Ramanan ramzz S, Sawarnik Sawarnik Kaushal

  • Admin : Teja teja349 Vardhan Reddy

  • Tester: Yash yashChandnani Chandnani

  • Editorialist: Ishmeet Psychik Singh Saggu

  • Statement Verifier: Jakub Xellos Safin

  • Mandarin Translator: Gedi gediiiiiii Zheng

  • Vietnamese Translator: Team VNOI

  • Russian Translator: Fedor Fedosik Korobeinikov

  • Bengali Translator: Mohammad solaimanope Solaiman

  • Hindi Translator: Akash Shrivastava

Prizes:

Top 10 Indian and top 10 Global school students from ranklist will receive certificates and CodeChef laddus, with which they can claim cool CodeChef goodies. Know more here.

Good luck and have fun!

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

»
13 months ago, # |
  Vote: I like it -58 Vote: I do not like it

my contest ! my love Codechef ! my 6 star swag !

»
13 months ago, # |
Rev. 2   Vote: I like it -7 Vote: I do not like it

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

hoping not to see Internal Server Error this time :p

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

Atcoder abc177: 5:30pm to 7:10pm

CC lunchtime: 7:30pm to 10:30pm

Facebook Hackercup Round 2: 10:30pm onwards

Sacrifices have to be made today. :(

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

List of things learnt from today's contest : codechef lunchtime occurs at dinner time

»
13 months ago, # |
Rev. 3   Vote: I like it +28 Vote: I do not like it

I would like to post the stuff I did in case it helps anyone.

Problem ARRGAME: For Nayeon to have any chance of winning he must pick biggest block of zeros (which must be unique). Let mx = length of this biggest block. If mx is even, Tzuyu can pick position adjacent to Nayeon and win. If length of block is odd, Nayeon can pick middle position to neutralize this strategy. So to win Tzuyu would have to pick another block of zeros with length > (mx+1)/2.

Problem ALIENIN: Binary Search the answer to find max cool down.

Problem CNTGRP: First we build tree, then remaining edges must be between nodes with same level in tree. To build tree each node with level ai must be connected with some node with level ai-1 => if number of nodes with level ai-1 is f[ai-1] then we have f[ai-1] ways to choose. Just multiply these for all nodes. Now compute number of possible edges between nodes of same level, we must choose m-(n-1) such edges. Compute binomial coefficient and multiply with answer.

Problem SHENQ: I only did partial 50 points. Doing small test cases gives the necessary insight. There are four cases to consider: elements even/odd, length even/odd. You can find formula to solve in O(1) for each case.

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

    In the problem of alien invasion, the cool down time was a floating point value. How do we know when to stop it? I am confused in that.

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

      You only need to get a few decimal points corrects (check output section).

      So you can do binary search while length of interval is bigger than 1e-7.

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

what is wrong with my code for https://www.codechef.com/LTIME87A/problems/CNTGRP

my code — https://pastebin.com/0xn1TUXz

I am getting partial score. thanks in advance

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

    you can't calculate nCr like that, since n can be very large

    instead, first find n!/(n-r)! which is equal to n * (n-1) * .... * (n-r+1) and modInverse(r!) and multiply them ( since r will be < 2e5 here )

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

      wow I didn't even think about it like that guess I have much to learn.. thanks for your help. I got AC thanks again.

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

Idea for Elevator? I tried using dp, where dp[i][0] denotes least number of changes until the ith point(considering only non -1 values) and currently going down and dp[i][1] is for currently going up. But I thought there were a lot of cases to handle and I couldn't simplify.

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

This was one of the best contests i have seen in recent times. The problemset was well balanced, covering lot of topics. Kudos to problemsetters and testers !

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

NEED HELP FOR ELOMAX

https://www.codechef.com/viewsolution/37240579

can someone give me a counter case where my code fails ? I’m simply finding the score of each player after the ith round and maintaining 4 arrays separately for bestrank so far , bestrating so far, and month number for bestrating and bestrank. I guess my method is simple brute force with simple implementation, am i missing something ?

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

how to solve Ratings and Rankings this problem ?

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

    I can tell you what i did to solve it. First lets construct a matrix rank[i][j] which tells us the rank of the person i after jth month. Then just iterate thorugh the entire row for person i to find the minimum rank and maximum rating if they occur at the different index then update the count else move to next person.

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

Can you tell me what is the first testcase in each subtask for the task CHEFPART?

It seems to have some other special case besides appearance of one bit in the single number.

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

    Unfortunately, one of the edge cases in CHEFPART was handled wrongly in the official solution, as you had figured out. This has been fixed, all non-AC solutions rejudged, and we will recalculate the ratings for the 2 users who have been affected by this. Apologies for the mistake!

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

      You should change your handle to I_Am_Always_Sorry

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

      One of them is me) Actually I would be able to finish with full solution, if I know that my approach passes first subtask, but anyway I'm happy with 6th place)

»
13 months ago, # |
  Vote: I like it -67 Vote: I do not like it

very easy contest.

Solved Everything

I wanted to take part i would become 7 star but then i remembered the love of my life. my 6 star and i don't want to lose it. then i didn't give contest. and not because i was unable to solve any questions