Adding a Problem
A problem consists of a Problem description, input files and output files. Problems also support multiple outputs, that is the outputs can be verified using a checker.
Copying the data files
Copy the problem description to data/problems/problem-name.html
Note that this file contains only the body part of the HTML, for example the following is valid:
<h1>Problem name</h1> <p>hfafaf
fafasf</p>
Try to keep the contents XHTML strict, although that's not an absoute requirement.
Create a directory called data/problems/problem-name and copy your input and output file to it. (Right now I'm assuming that there's no checker involved). The testcases are numbered from 0 to T-1, so name your files as 0.in, 0.out, 1.in, 1.out...
Setting up the problem
Once this is done run admin/addproblem.php from the command line. Give the problem a problem ID, a nickname etc. If you need to provide a contest, ensure that you've setup the contest correctly before running this script. Follow the instructions, give each testcase a score. Leave "resourcelimit string" as blank, unless you want some special control. The script will abort if any of the files in last section have not been copied correctly. Apart from the problem ID, you don't have to worry too much if you make a mistake while entering an option.
Once this is done, the problem should appear on the judge problem page, and you should be able to submit to it. Verify that everything is working ok by making a submission.
Editing the problem, and finer grained control
Once you've set up the problem, a file by the name data/problem/problem-name.xml is created. Editing this file will edit the various options associated with the problem. There are some options that aren't filled in by default.
grading-style
There are two grading-style's: "opc" and "ioi". In "opc", the each testcase is run till the first failed testcase, if any testcase fails, then you get a score for only the submissions till this point that have passed. In "ioi", each testcase is tried, even if some testcase fails in between. The score is just the sum of individual scores.
Each problem can have a individual grading-style. Use <grading-style>opc</grading-style> to change the grading style to opc.
resource, author
<resource> can be used to specify where the problem was taken (nicked) from. This is for meta-information, and is displayed while viewing the problem statement. e.g.
<resource>CMI Online Programming Contest 2007</resource>
Similarly author is used to give the author of a problem. The author is only a friendly name, and not necessarily a user on the system. e.g.
<author>Arnold Noronha</author>
hook
Don't use it. I'm just listing it here because it exists. You can do some powerful things with this.
checker
Specify a manual checker for the problem. The checker can be any executable program/script on the system. Note that you can provide the path relative to the backend installation. e.g.
<checker>data/problems/MyProblem/checker.sh</checker>
The checker behaviour is as follows: it takes two parameters: The outputfile generated by the participants code, followed by the output file given in the problem statement. The checker returns Zero if the output is accepted, and non-zero value otherwise.
In some instances, you may want to provide custom scores depending on the output. In this case, you should first add the following node in the XML file.
<checker-outputs-score>true</checker-outputs-score>
In this case the checker should output the following on stdout:
<score> <small description>
Note that <small description> will be visible to the user, in fact, it will be displayed on the queue page. Therefore: 1. don't output sensitive information, and 2. Keep it short. If the checker returns 0, then any score outputted will be disregarded and the score will be set as 0.
Notes
If you ever change any description/data pertaining to a problem, you may need to rejudge all submissions to that problem.
