How do I upload a problem on CodeChef?

Recently I have received access to upload a problem on CodeChef. I want to know the process of how to do so. Can anyone help me to do so?

2 Likes

Once your account has been granted problem setting rights or you are given access to an account with problem setting rights, go to http://campus.codechef.com and login with the credentials. Navigate to http://campus.codechef.com/problems/my. This page will look something like this.

The tab titled ‘My Own Problems’ shows a list of all the problems created by your account. If you want to edit any of the previously created problems, you may click on the link for that problem which appears under this tab and click on the ‘Edit Problem’ button which appears on that page. If you want to add a new problem, you may simply click on the ‘Add Problem’ tab which will take you to a page which looks like this.

Let’s take a look at the different fields and their significance.

  1. Problem Code’ : You might have observed that when you click on a problem name in any contest or in the practice section, you are taken to a link like http://www.codechef.com/problems/CHEFGR or http://www.codechef.com/OCT14/problems/CHEFGR. The term CHEFGR is the problem code. If you are uploading problems for a particular contest, then the codes for the problems you upload should follow some specific format. For example if your contest name is TP-Coder, you could have problem codes of TP01, TP02, TP03 and so on. Something of this sort is preferred so that it is easier to quickly find out which problem belongs to which contest. The code should be in capital letters and can include only alphabets and numbers. No other characters like commas, hyphens, spaces etc. are allowed.

  2. Problem Name’ : This is the title that will appear for your problem. On the contest page, your problem will appear with this name. For problem names, you can include spaces, alphabets and digits. No other characters are allowed.

  3. Co-authored by’ : This is a drop down box. Keep it at the default value of ‘No one’.

  4. Source code limit’ : This is the maximum size(in bytes) of any source code that can be submitted for this problem. Any source code file which has a size greater than that mentioned in this field will throw an error saying that the file size is too large. You can keep it sufficiently large at the default value of 50000.

  5. Resource’ : If you want to attribute the problem idea to the original author or website, you should put it here.

  6. Assessment type’ : This should be set to ‘binary’. But, incase of Sub-Task or Partially Graded problems it should be set to ‘subtask’ and for challenge problems it can have assessment type of ‘maximize’ or ‘minimize’.

  7. Test Data Ready’ : If this box is unchecked, no one can submit solutions to the problem. This should always be checked, preferably only after the test cases have been uploaded and the problem is good to go.

  8. Problem Body’ : The problem statement formatted with html tags etc. as mentioned in the FAQ for Problem Setters needs to be pasted in this textarea. Delete any text that appears by default and paste the text for your problem. You can read more about formatting the problem statements [here] 14.

  9. Dynamic Content’ : This checkbox should be kept unchecked. Check it only if you include links in your problem statement to content that can change over time.

  10. Master Judge for multiple datasets’ : This should be set to the default value of ‘1000. Generic Masterjudge’. Do NOT change this unless you want to implement Partial Judge (only for Sub-Task or Partially graded problems), you need to set it to ‘1003. Generic Sub-Task Partial Judge’ or you can even create your own judge.

  11. Available Languages’ : You can select what all languages your problem can be submitted in here.

  12. Include new languages’ and ‘Merge all languages in ranklist’ : These should be checked.
    Once you have filled in the necessary information, click on the button titled ‘Create’. Click on the link titled ‘See problem page’. This will take you to your problem page. Now, you need to click on the ‘Edit problem’ button which will take you to the problem editing page. You will see that a few extra fields like ‘Problem test sequence’, ‘Test data upload’ and ‘Rejudge Submissions’ have appeared.

  13. Test data upload’ : By default, test case 0 has blank inputs and a time limit of 1 second. The input and output test cases need to be uploaded here. For the first test case you want to upload, click on the drop-down box titled ‘Add/modify test case’ and select ‘Modify testcase #0’. In the ‘Input file’ textfield, click on choose and select the file containing the input data for the 0th test case. In the ‘Output file’ textfield, do the same for the file containing the corresponding output data. Select ‘Overwrite’ if you want to replace any previously uploaded file. Select append if you want to append the data you are uploading to the data uploaded previously. The time limit in seconds for that test case should be entered in ‘Test case time limit’ textfield. This should NOT exceed 50 seconds. If you want to simply change the time limit for a particular test case, keep the Input and Output file textfields empty and select the ‘append’ option for both and enter the new time limit for that test case.

  14. Program Judge’ : From the drop-down box select the appropriate judge. ‘Ignores extra whitespaces’ will match the output created by the solution submitted to the test data, but ignore any trailing whitespaces or newlines. ‘Ignore FP round up to 10^-2’ will check the output created by the source code submitted with the test output uploaded for that test case, rounding the value to 10^-2 precision and then checking the answers. ‘Score is source length’ can be used in shortest code contests. Usually, for normal contest problems, this should be set to ‘Ignores extra whitespaces’. Once you have done this, click on the upload button. Your test case along with the data uploaded should be available in the table above the ‘Add/Modify testcase’ fieldset. If you want to add another test case, from the drop-down box select ‘Add testcase #x’ where ‘x’ will equal ‘highest test case number + 1’. If you want to modify a particular test case, from the dropdown box select ‘Modify testcase #x’ where ‘x’ is the test case number of a previously uploaded testcase you want to modify. Once all the test cases have been uploaded, you should scroll above to the ‘Problem test sequence’ text area. Here, add the test case numbers that you want to test submitted solutions against. Suppose you have uploaded 4 test cases numbered 0, 1, 2, 3 and you want to test submitted solutions only against test cases numbered 0, 2 and 3. Then, this text area should contain ‘#0 #2 #3’ without the quotes. The values should be separated by a space.

  15. Auxiliary data passed to the judge’ : This should be empty (for all problems except sub-task/partially graded problems). Check the ‘Test data ready’ checkbox as mentioned above and click on the ‘Modify’ button. Your problem is now ready and can be added to your contest. You can read more about uploading the Auxiliary Data [here] 13.

  16. Scoring mechanism’: The scoring mechanism should always return positive scores. Negative scores will have undesirable effects under system ranking mechanism.

You can now add all the other problems in the same manner.

P.S: The time limits apply to the full test file (which can have multiple test cases) and not to individual test cases.

In order to submit solutions to the problem, you need to add it to a Test page that has been provided to you. Please refer [“How do I test my uploaded problem on CodeChef?”] 7.

Reference links:

[FAQs on uploading problems on CodeChef] 8

Formatting problem statements on CodeChef

Various types of Judges that can be used for a problem

General FAQs

5 Likes

@admin How do I upload already existing problem on codechef to a contest that I want to hold?

why it showing error on submitting answer??

Have you got access to problem setting page ?
If yes then, what type of error are you getting ?
I have one experience of problem setting… One of the reason could be selecting wrong judge.
Ping me exact error so that I can try to help you.

Email them at [email protected] with a screenshot. Usually you’d need to ask them for a testing page access before submitting.

In the Post Script admin has written: “P.S: The time limits apply to the full test file (which can have multiple test cases) and not to individual test cases”

What exactly is meant by test file and test cases??