Invitation to CodeChef February Cook-Off 2020

Greetings CodeChef community!

CodeChef invites you all to join us at CodeChef’s monthly serving of the Cookoff. A 2.5 hours contest with five servings of challenging problems for you and your peers to relish. Crafted out of the very best ideas, our set of curated problems will take your code buds on a delightful trip.

Further, the February Cookoff will be the perfect opportunity to give a boost to your CodeChef ratings and rankings. Meanwhile, you can also share with us some original and engaging problem ideas which can be used in CodeChef’s future contests, here:

I hope you will participate with your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

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: 16th February 2020 (2130 hrs) to 16th February2020 (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 !!


I felt like problems of div1 were very classical and simple.
There is something unusual about this contest. Not upto codechef standards or not intresting IMO.
Won’t comment on last two problems because I couldn’t solve them.


Yeah, the first problem was very familiar. I bet i have seen it somewhere :thinking:

1 Like

How did you guys solve " Chef and Pepperoni Pizza Again". I tried computing 2d prefix sums (top_left,top_right,bot_left and bot_right) using dp and used greedy approach afterwards. I don’t know why it is failing. Any good test cases ?

I think Kadane’s would TLE for p2 @karangreat234
It’s a classical segment tree problem with
Maximum prefix sum
Maximum suffix sum
Maximum subarray sum
Total sum


This time questions were more of standard one and less difficult compared to regular cook-off contests.

Funny thing is : I used to be discontent about my college’s contest . But,the last question of div.1 was very similar to our college’s interwing contest.

Though I couldnt complete it in time.


No x1, x2, x3

Not having fun :frowning:


and original source is

1 Like

How will rating changes work with the February Long Challenge currently happening? I might jump back to Div1 after Cook Off results are in, but that’s during the Div2 Long Challenge.

Just find the absolute difference b/w left and right value for each row.
Now you get array of size N.
Just find a subset with sum nearly equal to total sum/2.

@akashbhalotia as editorialist xD very nice :blush:
Congratulations :tada: and hoping for nice editorials :smiley:


I think that you have to add difference between left and right value for each row and “not absolute difference”, and then find subset with sum near to sum/2. Also, can you help me find flaw in my approach ? Thanks.

Edit: Never-mind, I found flaw in my approach.

1 Like
I was trying to solve Maximal Sum question from yesterday’s cook off

I tried to solve it using the segment tree method mentioned by replicating the array and using the algo mentioned in CP-algorithms site.
Can somebody tell me where i am wrong? :slight_smile:
I am afraid i can’t debug segment trees well because i am not that familiar with it :sweat:

In make data, you should replace max(0,val) to val.

Because sub sequence cant be empty.

1 Like

What rating would be considered for rating calculation? After Long or before Long?
have the same question for the other rated contest ICM

Thank You :slight_smile:
(Finally upsolved all the questions in div 2 XD)