Programming, Testing and Submission Environment

Overview

IOI 2010 requires contestants to develop program source files in C, C++ or Pascal that are compiled and tested in a larger environment. The contestant's code will not read and write files or use standard input and output. Instead it will be invoked by a grader program, which is supplied by IOI. For each task, there will be a specific directory containing a skeleton implementation that includes all necessary files. The contestant will have to modify specific files to include code to meet the task requirements.

IOI will provide a tool called RunC to compile, link, and test the task solution along with the necessary grader components. RunC may be invoked from the command-line, or using hotkeys from the gedit text editor. The use of RunC is not mandatory -- the gcc, g++ and fpc commands are available should the contestant wish to use them. However, the scoring system will use RunC, and we believe contestants will find it convenient to use RunC for development and testing.

About the RunC development and testing tool

RunC is a set of scripts that may be invoked from the command line, or from gedit in the gnome desktop environment.

At IOI 2010, RunC will be installed on every contestant workstation.

For practice, the latest version of RunC may be installed on Linux, or MacOS or Cygwin/Windows. To install RunC, type

   wget -N http://plg1.uwaterloo.ca/~gvcormac/RunC-IOI/RunC-latest.sh
   sh RunC-latest.sh
   sudo ln -s ~/.RunC/runc /usr/bin
(You can also download a local version of RunC.)
If you cannot run the sudo command, you must use ~/.RunC/runc in place of runc in the following instructions (or use the gedit plugin).

If you want the ``lite'' version of RunC (just the command line without the gedit plugin) perform the following three steps:

   wget -N http://plg1.cs.uwaterloo.ca/~gvcormac/RunC-IOI/RunCcmd-latest.sh 
   sh RunC-latest.sh
   sudo ln -s ~/.RunC/runc /usr/bin
(You can also download a local version of lite RunC.)
If you wish to use Pascal, you will also have to download and install Free Pascal (available from the Ubuntu package manager; for other platforms from freepascal.org). If you do not have gedit, the command-line commands will still work. The submit command and plugin will work only on the IOI contestant platforms.

The RunC tool is used to build the program and to run it on a suite of tests. A submit command (also available as a gedit plugin) is used to submit the program for scoring. Results and scores for submissions are viewed using a web interface.

Program Structure

The program and test examples for each task will reside in a particular source directory (folder). For example, the directory for the demonstration task guess will be in the folder /home/ioi-contestant/guess. A skeleton implementation (that builds and executes correctly but does not fully solve the task) will be provided, both in the specified directory and as a zip file that may be used to recover the original files if necessary, or to solve the task at home.

The specification for task guess requires the contestant to implement a function play in the file player.c or player.cpp or player.pas. The mainline program, called grader.c or grader.cpp or grader.pas, is supplied by IOI.

Compilation, execution and testing

There are two ways to compile and execute your solution:
  • In a command line window, with the task folder as your current directory, type one of
              runc grader.c
              runc grader.cpp
              runc grader.pas
    
    Alternatively, you may specify any file that is part of the program, instead of grader.c. runc will automatically compile all necessary files. Or you may compile the program manually using gcc, g++ or fpc.
  • In gedit, when viewing any program file, enter
              Ctrl-R
    
    That is, hold down the Ctrl key, and press R. Please see the illustrated RunC tutorial for more information.

Here is an example of what you will see, either on your terminal or in a message panel of gedit:

      $ runc grader.c
      Compiling grader.c grader.h player.c player.h
      Running grader.c -- input from grader.in.1 -- output to grader.out.1
      Program has finished.  No runtime errors.
      Running grader.c -- input from grader.in.2 -- output to grader.out.2
      Program has finished.  No runtime errors.
      Running grader.c -- input from grader.in.3 -- output to grader.out.3
      Program has finished.  No runtime errors.
In general, test input files must be in the task directory and named grader.in.1, grader.in.2, and so on. Any file matching the pattern grader.in.* may be used. These files supply parameters and input data to the grader, which in turn uses them to call the contestant's solution. The grader outputs summary results to the corresponding file named grader.out.*.

Note that the grader program, not the contestant's solution, does all input and output. The contestant's solution receives and returns all data by procedure calls. Contestants are welcome to modify the grader or the test files as they wish, in order to test their solutions. Note that the sample grader implements the required interface, but does not necessarily enforce all of the constraints given in the task specification. Furthermore, the sample test cases are not exhaustive. The official grader and test cases are not available to contestants.

If there exists a file matching the pattern grader.expect.*, it will be compared automatically to its counterpart grader.out.* and an error reported if they differ. For example,

      $ runc grader.c
      Compiling grader.c grader.h player.c player.h
      Running grader.c -- input from grader.in.1 -- output to grader.out.1
      Program has finished.  No runtime errors.
      Output is equal to grader.expect.1
      Running grader.c -- input from grader.in.2 -- output to grader.out.2
      Program has finished.  No runtime errors.
      Unexpected output ... see grader.check.2

Debugging

So that you may debug your program if necessary, runc creates an executable file called grader.exe, suitable for use with gdb or valgrind.

Submission for Scoring

IOI scoring uses a different implementation of the grader, different test files, and a separate grading server. There are two ways to submit your solution for scoring
  • in a command window
              submit grader.c
              submit grader.cpp
              submit grader.pas
              submit solution.txt  for output-only tasks
    
  • in gedit, when viewing any program or solution file, type
              Ctrl-J
    
Notes: You must be in the appropriate task directory, because the submit command and plugin determine the task name and files to submit from this directory. You may submit any file ending in .c or .cpp or .pas and all other necessary files will be gathered together by submit. You may not submit more than once per task per minute. Submissions must not exceed 1MB in size.

Viewing Results

Programs will be tested as soon as practicable after submission. Please see the illustrated tutorial on how to view results.

There are two types of results:

  • Public tests. Public test results may be viewed as soon as scoring is complete.
  • Release tests. Release tests may be viewed only if released by the contestant using the Web interface. Results may be released only if (a) the public test passes, and (b) the contestant spends one "release token" to release the results. There will be at least five release tokens available per task (one token releases results for all subtasks). That is, contestants will be able to view the results of five separate submissions for each task.

The test results will indicate pass or fail. For failed tests, the information available from RunC will be shown. This information will contain one or more of:

  • Compile error
  • Run-time error
  • CPU limit exceeded
  • Output limit exceeded
  • Unexpected output
  • Correct
  • Score