Invitation to CodeChef December Cook-Off 2019

Greetings CodeChef community!

CodeChef invites you all to join us at CodeChef’s December serving of Cook-Off. A 2.5 hours contest with five challenging problems. This will be a great test for your code muscles.
This will be a perfect opportunity to improve your CodeChef ratings and rankings. Also if you have some original and engaging problem ideas, and you’re interested in them being used in the CodeChef’s contests, you can share them here:
I hope you will participate with your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

  • Setter and Editorialist: kmaaszraa (Kasra Mazaheri)
  • Tester: ckodser (Arshia Soltani)
  • Statement Verifier: xellos0 (Jakub Safin)
  • Admin: teja349 (Teja Vardhan Reddy)
  • Mandarin Translator: sam__2 (Qingchuan Zhang) - Vietnamese Translator: songuku95 (Team VNOI)
  • Russian Translator: gomelfk (Fedor Korobeinikov)
  • Bengali Translator: solaimanope (Mohammad Solaiman)
  • Hindi Translator: devils_code (Akash Srivastava)

I hope you will enjoy solving them. Please give your feedback on the problem set in the comments below, after the contest.

#Contest Details:

Time: 22nd December 2019 (2130 hrs) to 23rd December 2019 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Contest link:

Registration: You just need to have a CodeChef handle to participate. For all those who are interested and do not have a CodeChef handle, are requested to register in order to participate.


Top 10 performers in Global and top 10 performers in the Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: How do I win a CodeChef Goodie?.

Good Luck!
Hope to see you participating!!
Happy Programming !!


Looking forward to my first contest…:slightly_smiling_face:


I just hope that this time the editorial will be released as soon as possible! Please keep them ready :slight_smile:


I don’t think you would need editorial on Codechef. The community is very welcoming here unlike Codeforces , probably because there’s no downvote button. But people here really help you, in case you’re stuck :slightly_smiling_face:


So true :slight_smile:


also maybe because of Culture & Brotherhood of our country :slightly_smiling_face:


hey karangreat234 i am karangreat too :wink:



Fk this char limit.


Why the name " The Inexplicable Giant Floating Baby Head"? You could have named it “And It” :stuck_out_tongue:

1 Like

@kmaaszraa why does the contest page still display half an hour left, isn’t it supposed to end at 12 AM?

Whats your output? @hetp111

I cant find any TCs giving any unexpected answer…

NO answer should be 1 :slight_smile:

1 Like

remove 1 between zeroes :slight_smile: 111100010001111

1 Like

ya my answer is coming 1 , any other tcs

For P.3
I got TLE. My algo was of O(T.max_R)

you can check my dp solution in o(n) time

Still feel like it’s a greedy problem…
We can add this kind of cases too.

My approach (missing this kind of cases):
find the longest substring of zero(Z) and one (O) And answer will be min(Totalzero-Z,Totalone-O)