-
Notifications
You must be signed in to change notification settings - Fork 79
[EN] 1. Basic package
Upon submission to SIO2, a program is executed on several tests prepared by the problem's author. Each test is described by an input file, an output file, and time and memory limit. The input file's contents are redirected to the submitted program's standard input. Upon successful execution, if neither time nor memory limit were exceeded, the program's output will be compared with its respective output file provided within the package. If both files match, the program will be awarded points for the test.
A package consists of a compressed archive whose contents include test files and a problem statement. The archive formats accepted by SIO2 are: .tar, .tar.bz2, .tar.gz, .tgz, .tz2 and .zip. The archive should contain a catalogue with a name corresponding to the problem's short name. A short name is a string of lowercase Latin alphabet characters identifying the problem. It is customary for the short name to consist of 3 characters, usually the first three letters of the problem's name. Now, let us prepare a very simple package to get the gist of it.
We are going to create a package for a problem named Square. Naturally, its short name is going to be squ. We will expect a correct solution to read a number from the standard input and write its squared value to the standard output. The final version of the package is available for download here.
A basic package needs to contain the following catalogues:
- doc – contains the problem statement
- in – input files
- out – output files
- prog – additional source files (optional; this time, we will leave it empty)
The easiest way for providing problem statement is by including a PDF file named {problem's short name}zad.pdf in the doc directory. We can build it in any way we find most convenient (TeX, MS Word, Google Docs). Our problem's statement will be included in the file squ/doc/squzad.pdf.
At SIO2, test cases are marked with consecutive natural numbers. Input files are named according to the following pattern: problem's short name + test number + .in (the file's extension). The output files' name follow the same pattern, except their extension is .out.
Let us now prepare a couple of tests for our problem. Given its simplicity, we can generate both input and output files manually, maybe using a simple calculator when necessary. In case of a more complex problem it will be more convenient to use a pre-made model solution – we will cover this in a later tutorial.
Our very first test will be squ/in/squ1.in. According to the statement we have provided earlier, it should contain one number from the range [-1e9, 1e9] – in our case it will be the number 0. It is vital for the input file to strictly abide the rules described in the problem statement. Particularly important to remember about are the whitespace characters: spaces, tabs, line breaks.
The correct answer to the test will be, obviously, the number 0, so we will add it to the file squ/out/squ1.out.
This test, and several others, have been added as input and output files to the catalogues squ/in and squ/out. In particular, a test containing a negative number, squ2.in, has appeared, as well as a test with a number big enough to cause 32-bit integer type overflow when squared: squ5.in. More advice on composing good tests (correct and complete) will be provided in a later part of this guidebook.
At this point our package is ready to be submitted to SIO2. In order to do so, let us compress our folder to one of the formats accepted by the judge system: .zip seems to be the easiest option. Regardless of our operating system we can use 7-zip to compress the package to our desired format. At Windows, we need to right-click on the folder, and from the menu choose 7-zip and Add to squ.zip. At Linux we can use the following command in the system shell:
7z a -tzip squ.zip squ
Now, at SIO2, we enter the contest we want to add the problem to. At left, a Contest Administration button should be available. Click it. From the list that has appeared choose Problems and then Add problem. Choose the round and add the compressed file. Upon clicking Send you will be redirected to the Problem packages panel. In a short while our package's status should turn green and say "Uploaded" (you may need to reload the page to see it change).