Invitation to CodeChef April Long Challenge 2018!

Hello Fellow Coders!

Greetings from Chef! Close on the heels of an exciting lineup of contests you all enjoyed, here’s more from Chefland to satisfy your coding appetites in April. This time it’s not a quick snack, it’s a full-course meal with ten days prep time!

I would like to invite you to the April Long Challenge 2018 for 10 days of exciting programming challenges. Joining me on the problem setting panel are:

Please give your feedback on the problem set in the comments below, after the contest.

Contest Details:

Time: 6th April 2018 (1500 hrs) to 16th April 2018 (1500 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 global and top 20 Indian winners get 300 Laddus each, with which the winners can claim cool CodeChef goodies. Know more here: . (For those who have not yet got their previous winning, please send an email to

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


As an additional reminder-

Kindly discuss any issues, clarifications etc. related to problem/problem-statements at COMMENTS section of the problem with the setting panel. Any feedback related to this long should be posted here only - the use of separate threads should be avoided as it makes collecting feedback a mess.

Any instance of your code getting public due to online ides like is punishable, and you will be penalized with same punishment as that of any regular plagiarist.

If possible , the challenge should be extended just for a day .As we are having Google code jam today.

For 300 laddus rank should be in top-20(Indians) in Division-1 or top-20 in both divisions combined ?

why duration of APRIL18 long challenge of div-B is not extended while for div-A it is already extended?
@mgch @vijju123

Because code jam take almost one full day.So many participant cant try problem through out whole day…if you kindly extend it…it will be better…@vijju123

thank you @vijju123

when will the editorials get uploaded.

@admin @mgch . I was seeing all submissions page Just after the contest was over. There were submission which were still processing after 3.30 pm. Big queue was there on system. At around 5-6 am. System was taking about 3-4 min to process the result.

One suggestion Please don’t make the challenge problem such that anyone can atleast get AC. For this contest challenge problem Submissions which simply print A[i]. No processing. Or which print A[i]+k . Were awarded around ~80-90 points. This was the main reason for Big Queue.

1 Like

So with this we conclude our April Long Challenge, 2018.

We hoped you enjoyed the problems, and will enjoy the editorials as well. Any feedback on problems, editorials, or any other issue is appreciated. We will try our best to improve upon those areas :slight_smile:

If theres anything we can do for you, do let us know. Its been a pleasurable experience for me on the other side of the panel (thanks to the team and @mgch ) and I hope I can say the same for you guys as well :).


One of the high-scoring solutions to CHEFPAR worked by reverse-engineering some of the parameters for the hidden problems and individually optimising different random seeds for each hidden problem. This was done by making use of the fact that you get told if your program aborts on a hidden problem, so some hidden information leaks back. The program would not work so well (or might not run at all) on a new random problem instance.

I don’t know if this is allowed or not, but I don’t think it is a desirable feature (and I wouldn’t use this method) as it seems to be against the spirit of the competition, in my opinion anyway. I suggest that the challenge problems be adjusted in future to reduce the effectiveness of this method. One thing that could be done is reduce the number of submissions allowed, since 200 is rather a lot: 50 should be plenty since you can try your method offline on test data. (Maybe even less than 50 is better.)

Another problem is that there are potentially even larger information leaks from the non-hidden problem instances (four instances in this case), because you get to see about 20 digits of output and there is execution time and memory usage that can be manipulated. Perhaps it would be a good idea to exclude the non-hidden problem instances entirely from the final judgement (in this case judging on 16 instances rather than 20). At least, that would fix this subproblem (information leak from non-hidden problem).

I suppose the nuclear option is not to give any information back at all (even TLE, RE etc) about what your program did on the hidden instances. I would personally be in favour of this, though I realise this could lead to disappointments if none of your submitted solutions run properly on the hidden set of instances.

1 Like

@vijju123 CHEF VIJJU’S CORNER Nice initiative. Increases the effectiveness of editorial. And helps a lot in overcoming mistakes.

1 Like

Suggestion for how to prevent reverse-engineering of challenge problems.

Taken from the thread on CHEFPAR and reverse-engineering instance parameters. In my opinion it is better if the competition is to find the program that works best on a random problem instance, rather than being a competition to reverse-engineer the hidden (or visible) instances. I think that would make CodeChef a more attractive environment to compete in (it is already very good, by the way - I hope this suggestion might help make it a bit better).

Definitions: by “feedback-instances” I mean those which contribute to your provisional rank, and for which you get back a score (four of these in the CHEFPAR contest, one for each type). By “hidden instances” I mean those for which you don’t get a score back during the contest (sixteen of these in the CHEFPAR contest, four for each type).

As far as I can make out, there are two competing needs:

(i) It is nice if people can be confident during the competition that their program will work (not abort, time-out etc) on hidden instances, so they need some kind of feedback during the competition that it works on hidden instances. It’s also nice if people feel able to try out lots of solutions over the 10 days.

(ii) It is good (in my opinion, anyway) if you can’t use the information from the result code (AC, TLE etc) to reverse-engineer parameters of the hidden instances. It’s also good if you can’t use the result information (score, time, memory usage) from the feedback-instances to reverse-engineer their parameters.

I think you can satisfy both of these needs by the following modifications to the rules:

(i) You are still allowed to submit a lot of answers (say 200), but in only (say) 20 of these will you get result code feedback from the hidden instances. 200 should be plenty to try out lots of ideas, and 20 should be plenty to make sure your program (that you already know runs successfully on feedback-instances) doesn’t crash on hidden instances. The user would get to choose which (up to 20) submissions count for the extra result code information. (The displayed time and memory usage would be taken from the feedback-instances, so you can’t get extra information about the hidden instances that way.)

(ii) feedback-instances are excluded entirely from the final score (after competition ends). In the case of the April 2018 challenge, that would mean you would be judged on 16 hidden instances rather than 20 = 4 + 16 instances. The reason for this is that it is very easy to leak information back from the feedback-instances, much easier than from the hidden instances. For example in CHEFPAR, during the competition you got back a 16-digit final score: you could encode information in some of these digits, so you get back much more than 1 bit of information per submission.

I think these changes would keep most of the necessary feedback so that users know their code is working and preserve the fun of seeing a live scoreboard, but would mostly prevent the problem being “hacked”.

1 Like

For Documentation. Today as soon as editorial were released. Our @vijju123 were quite active in forum to answer queries of users. This is also a Nice initiative. If we have someone from problem setting panel to resolve our queries. =

1 Like

@aryanc403- Why? Thanks mate for the compliments!

We intend to do that as a regular practice to be honest, but problem setters are really busy at times. Like, some are having end-semester exams &etc. Even I have those, but comparatively I am a bit free right now, so I am trying to resolve as much as I can :slight_smile:

This time, I also tried to answer as many comments as I can xD. Just to assist setters. You wont believe, but we had over 150 comments for weightnum alone, all saying one thing “Why is W upto 300?”

Well, there is only 1 @vijju123 in entire world. And I have the motto that “If its me, things should change for good :slight_smile: .” I tried my best to act on lines I expect the panel to act- eg- answering all comments, even if its a trivial “Comment denied” or “Asking for hints isnt allowed.” Its really important in my opinion, that, setting panel should respond to comments else there hangs a feeling of “Aloofness”. Like, in CF rounds, all queries get answered, even if it takes 5-10minutes. If it happens there, why not here?

Though, I must agree on other side too, answering comments is tiring. For AVGPR and WEIGHNUM, there were like, 10 new comments every hour. Dont believe me? See the tab below-

Click to view

alt text

And that brings me to one of my key points. People, especially Div2, should NOT share ideone links etc. in comments, not ask for hints, or ask setter to debug his/her code. Thats simply outrageous. Because of that, we keep on missing some valid comments :frowning:

1 Like

This is to inform you that all the Setter’s, Tester’s and Editorialist’s solutions are successfully linked to the editorials, except for CUTPLANT.(I am in talks over this delay for that editorial, we will look into that).

The editorialist solution is commented most (I think all :stuck_out_tongue: ) the time, so you can refer to that in case you have any further doubt. Hope you enjoyed the editorials as much as (or preferably more :p) than the problems. In case there is any further issue accessing solution of any other editorial, except CUTPLANT, do ping me here, we will look into that. With that, I would like to conclude the final announcement for this long with three magical words…

Click to view


1 Like

Just chiming in to the lovely discussion of @alexthelemon and @algmyr.

As I see it, the essence of the CodeChef tie-break problems is to design an efficient algorithm that finds approximate solution to an NP-hard problem. You are given the time and memory budgets, and also - which may not happen in real life - a nicely defined domain of the possible input values. Since a lot of approximation algorithms carry a significant amount of randomization techniques, it is appropriate to ask how the fairness of the judging process can be assured.

20 test cases is definitely too low of a number to have a 95% confidence that one algorithm is better than another. Furthermore, the current practice of taking the best result out of (potentially) 200 solutions favors the algorithms with high volatility of the results - which is kind of gambling.

Definitely, the first step is the clear separation of the provisional tests from the hidden/final ones. The purpose of the provisional tests is to give you some kind of calibration of your solution to the CodeChef system resources, and to give a quick test run. The final score should be calculated from the hidden tests generated for the final scoring only. Maybe a hundred test cases to give a good spread of the potential input values, and to reduce the element of darn luck.

The second step (which is more laborious to implement) is to give a contestant the choice which solution he/she considers as a final solution. Not the last solution, but the actual choice to define the final solution. We can even go one step further - not a single solution but multiple solutions. But out of multiple solutions, not the maximum score but the average score. Some people may prefer to gamble and choose a single final solution, some people may want to mitigate the risk (the downside) and choose multiple solutions (CodeChef may limit the number of final solutions by, say, 10). This way the final score calculation can still proceed at reasonable pace (more test cases but less solutions to check) and the judging as a whole appears more fair.

1 Like

Duration of APRIL18 will be extended by one day soon.

It really shouldn’t matter. GCJ was just for 27 hours.

Yes, but we extended APRIL18A from another reason - JADUGAR

1 Like