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:
Setters: Utkarsh Utkarsh.25dec Gupta, Mradul bhatnagar.mradul Bhatnagar, Nandeesh nandyboy Gupta, Nishant nishant403 Shah, Daanish 7dan Mahajan, Srikkanth srikkanthr R, Pallav Pallove Chauhan
Testers: Taranpreet taran_1407 Singh, Yahor 244mhq, Utkarsh Utkarsh.25dec Gupta, Surya evilbuggy Prakash, Nishant nishant403 Shah, Chaithanya Dragonado Shyam, Adithya infinitepro Dsilva
Statement Verifier: Nishank IceKnight1093 Suresh
Editorialist: Adithya infinitepro Dsilva
Contest Admins: Utkarsh Utkarsh.25dec Gupta, Daanish 7dan Mahajan, Nishant nishant403 Shah
Mandarin Translator: Qingchuan qingczha Zhang
Russian Translator: Kostia lkosten Yarmash
Vietnamese Translator: Team VNOI
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!
Pallove orz
Sir, I didn't find any email.. Then How i check my Final result of Round-1A ?
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.
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?
Use Maps see this simple approach.
Can you please explain your logic?
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.
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.