Invitation to RECode 20.0

Hello CodeChef Community!

“Attention all players, the game is about to begin.”

RECursion, the coding community of NIT Durgapur is glad to invite you to RECode 20.0 - an open to all contest which will be held on 15 November 2021 at 21:00 IST.

The contest is themed around your recent favorite series Squid Game! :))

You will be given 6 problems and 2 hours to solve them. It is highly recommended to read all the problems.

We present our special thanks to CodeChef for enabling us prepare and present the contest on such an amazing platform.

Prizes distribution are as follows :

  • Cash prize for Rs. 3000 for the overall top performer.
  • Cash prize of Rs. 2000 for the top performer from NIT Durgapur.
  • Certificates for all top performers.

For further details, contact :
Rushil : +91 85113 08746
Ankit : +91 8420998766

See you on the leaderboard!

Happy Coding :smiley:

PS : As a gentle reminder, the contest will start in less than 30 minutes.
Good luck to all the participants! :slight_smile:

PS : Editorials can be found here :-
Problem A — Marbles
Problem B — Deok-su and his Debts
Problem C — Ddakji
Problem D — Glass Stepping Stones
Problem E — Guard Quarters
Problem F — A Way Out


As a setter, I can say the problems are Interesting. :smiley:


Like the last RECodes, the contest is hopefully going to be great!


Looking forward to this contest !
Last RECodes were quite awesome ^-^

1 Like

As a Tester, I think the problem set is amazing.


PS : As a gentle reminder, the contest stars soon.
Good luck to all the participants! :slight_smile:

I think you guys should have mentioned an explanation of sample test case in problem C. I really spent more than half an hour trying to understand the meaning out of it! Otherwise the contest was good and I liked the problems!


same, I didn’t saw the announcement too and was not able to understand the question for a very long time but the problem set was very cool. i really liked the security guards problem.


How to solve Guard Quarters ?


i had a solution using centroid decomposition but I was not able to code it fully as it was very huge

please share your solution

The main idea is to use centroid decomposition.

For each centroid, we will try to store the number of nodes at a particular distance k from it in it’s part. Since sum of number of nodes in subtree of each centroid taken over all centroids is O(nlogn), using a map for each centroid to store the count will work.


Thanks a lot for your honest feedback. We are glad you like the problem set.
We are extremely sorry for the inconvenience caused . The problem statement in problem C was tried to be made as self-explanatory as possible. Hence, we skipped the sample test case’s explanation. We promise you to take a note of it in the next RECodes.
Thanks for participating

1 Like

Thanks! Seems like it’s high time for me to finally learn centroid decomposiion : )


You can refer to this amazing article for learning :).


My solution :- Solution

1 Like