Utkarsh.25dec's blog

By Utkarsh.25dec, 3 years ago, In English

We invite you to participate in CodeChef’s SnackDown 2021 — Round 1B, this Friday, 29th October, 9 PM IST onwards.

The contest is open for 2 days, i.e, from 29 — 31 October & is a second chance for the participants who couldn’t clear Round 1A, to qualify for the Pre-Elimination round. Check your email to know your results and details about how to participate in this round.

Joining me on the problem setting panel are:

Participants who get AC in at least 4 problems will qualify for the next round of Pre-Elimination.

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

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

| Write comment?
»
3 years ago, # |
  Vote: I like it +16 Vote: I do not like it
»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Sir, I didn't find any email.. Then How i check my Final result of Round-1A ?

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

How to solve Insider (fourth problem), That problem gave me so much pain and now I can't compete in pre-elimination.

Edit — I just read above comment and realized that I am qualified.

»
3 years ago, # |
Rev. 3   Vote: I like it +4 Vote: I do not like it

Whats the intended solution of INSIDER? I got a standard and trivial to implement segtree approach that works in $$$O(n logn)$$$ but I doubt its the intended.

Is there a way to maintain the length of the longest subsequence as $$$x$$$ increases without data structures? Or does the intended involve something like binary searching for the smallest / largest $$$x$$$ where the max length possible increases?

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

    Use Maps see this simple approach.

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

      Can you please explain your logic?

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

        At first make sure that the answer will be either valley + 1 or peak — 1 for any length and the elements on the slope are of no use.

        Post finding peeks and valleys find number of slopes that are having at least a single point common in between peak -1 and valley + 1.to find that I have used a standard prefix sum approach these prefix sums tell that a valley and a peek can be valid for length upto X. if at reaching peak (p) the prefix sum is X.

        Hence it makes sure that for right length we are having right answer.

        Maintian 2 auxiliary arrays which contains maximum and minimum values for a length.

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

    I solved by compressing all the values and then using a difference array to maintain how many times each number is covered by an interval. While compressing you also need to consider $$$x - 1$$$ and $$$x + 1$$$ for each value $$$x$$$ in the input array.