IOI'2003 Environment Manual

Version: 1.00 (First Hardcopy Version)/grg
Last modified: Fri Aug 15 14:32:11 CDT 2003

This manual is intended to provide IOI 2003 contestants with the information needed to use the supplied computers, programming environments, and grading system. This document does not explain the competition rules or procedures; for those, see the "IOI 2003 Competition Rules." Team leaders should help explain the contents of this document to their team.


As mentioned in the Competition Rules, Dell Dimension 2400 computers will be provided for all contestants. Each computer features:

Contestants are allowed to bring their own keyboards and pointing devices, and may bring CD-ROM blanks to back up their data during the appeals period. See the Competition Rules for detailed information.

Installed Software

The contestant will be able to boot to either Windows XP Pro or Red Hat 9.0 Linux. The Windows environment includes:

The Linux environment includes:

Running Windows XP

When it is booted, the computer will sit at the "DHCP" prompt attempting a network boot; you may hit the <ESC> key to abort this unnecessary step. Next, a menu is presented where you can click on the Windows icon to run Windows XP Pro. Log in as the 'ioi' user; there is no password.

On the desktop will be shortcuts to run much of the software installed for the competition: the icons labelled "Rhide," "Pascal IDE," and "Emacs" start rhide, Free Pascal IDE, and the emacs editor, respectively. There is also a quick-launch icon in the taskbar labelled "C:\" which brings up a DOS command prompt. Command-line compilation with gcc, g++, and fpc is possible (see the compiler flags below used by the grading system). You may use C:\ioi\ as your working directory. Use <CTRL>-<ENTER> to switch between windowed and full-screen mode.

In the upper right of the screen is a Language Bar where you may configure language (left) and keyboard (right) support. Other keyboards and pointing devices may be plugged into the PS/2 ports on the back or the USB ports on the front and back of the computer. The Language Bar may be minimized so that it resides in the task bar.

To create a CD-ROM insert a blank CD-R it into the lower CD-ROM drive; if it asks you what action to take, select "Open Writable CD Folder." After a few seconds a window will pop up; drag your files into this window and when you are done click on "Write these files to CD" in the upper left of that window.

An ergonomics aid named "RSIGuard" is installed; you may start it by clicking its icon on the desktop. It watches your typing activity and suggests appropriate times for you to take typing breaks.

Click on the Internet Explorer quick-launch icon in the taskbar to start a web browser through which you may access the competition server and grading system (see below).

WARNING: A known problem using C/C++ in rhide under Windows is that if any breakpoints are set in the program, you must not let the program terminate. If the program exits while a breakpoint is set, rhide will immediately exit as well. One solution is to set a breakpoint at the end of file, and when it is reached, reset the program (<CTRL>-F2) instead of continuing past the breakpoint.

WARNING: A significant known problem using Pascal in rhide under Windows is that the debugger will not work on your Pascal program. If you wish to use a debugger on your Pascal program, it is suggested that you develop using the Free Pascal IDE (which has a very similar interface to and works better than rhide).

WARNING: If you still insist on using Pascal in rhide under Windows, two more things you need to know are that you must set the "Project -> Main Target Name" to be the name of the source file without the file extension (e.g. if the source file is "example.pp", set the main target name to "example"), and that you should name all your Pascal source files using have a .pp extension so that rhide will automatically recognize them as Free Pascal files.

Running Red Hat 9.0 Linux

When it is booted, the computer will sit at the "DHCP" prompt attempting a network boot; you may hit the <ESC> key to abort this unnecessary step. Next, a menu is presented where you can click on the icon of the penguin to run Linux. Log in as the 'ioi' user with password 'ioi'. The Gnome window manager will automatically start.

On the desktop will be icons which run much of the software installed for the competition. There are icons to start rhide, xemacs, vi, xterm, xcalc, and xcdroast. The icon in the task bar which looks like a monitor runs gnome-terminal. Note that to allow compatibility with rhide, the default gnome function-key shortcuts have been disabled.

Of course, all of these programs can also be started from any shell by simply typing the command name. The gcc/g++ and fpc compilers and the gdb debugger can all be easily run from the command line; see the compiler flags below used by the grading system. You should always be working in your home directory, /home/ioi/, as you may not have write permissions on many other directories. You can return to your home directory from any other by typing 'cd' or by opening a new terminal window.

To reach a text-mode console, hit <CTRL>-<ALT>-F1; the first time you do this after booting you will have to log in on the text console. To get back to the XWindows screen, hit <CTRL>-<ALT>-F7.

To mount a floppy, insert it into the drive and click once on the floppy disk icon in the taskbar; this will create a new file window labelled "floppy." You can drag files into and out of this window and perform the usual file manager operations while the floppy is mounted. When you are done, click once more on the floppy icon in the task bar and then remove your diskette.

To write a CD-ROM place a CD-R blank into the lower CD-ROM drive and double-click the "xcdroast" icon on the desktop. Click the "Create CD" button and then the "Master Tracks" button. In the right pane ("File/Directory View") select the directories to be copied onto the CD-ROM, and then click the "Add" button below. In the dialog box which pops up, choose the directory structure you want on the CD-ROM, such as all files going into the root. To record the image, select the tab at top labelled "Create Session/Image," and click on "Master and Write on the Fly." Wait.

An ergonomics aid named "Xwrits" is installed; you may start it by typing 'xwrits &' in a shell. It watches your typing activity and suggests appropriate times for you to take typing breaks. 'man xwrits' will tell you that there are arguments to set the typing time and break time, among other things.

To configure a different keyboard, run 'rhide-config-keyboard' in a shell. To view a PDF document, use either 'ggv' or 'xpdf'. Finally, you can run 'mozilla' by clicking on the icon in the lower left which is shaped like a globe with a mouse cord around it; this will let you access the competition server and grading system (below).

WARNING: If you are using Pascal in rhide under Linux and you create a Project, you must set the "Project -> Set Primary File" option to be the name of the source file. Additionally, name all your Pascal source files to have a .pp extension so that rhide will automatically recognize them as Free Pascal files.

Competition Server and Grading System

By pointing a web browser at you reach the competition server, which contains documentation for programming languages and IDEs, documentation on the IOI competitions and tasks, data files relating to the tasks, and a link to the grading system itself. The grading system allows you to submit your solutions to earn points, test run your programs on the grading system, print, and back up and restore versions of your source code.

Logging In

The contest packet with the task statements will also contain a piece of paper listing your user ID and password. The user ID is printed on your name tag and is a string like "USAC1."

Using the instructions above, start a web browser and enter the contest server URL. You will be shown a form prompting for your user name and password, like this one:

Type in your user ID and password and click "Log In." This brings you to the main contest page, which looks like this:

You use this page to submit task solutions, submit programs and test data for custom runs, print programs, back up your files, and view your backups. Be aware that the clock and contest countdown timer at the top of the page do not automatically refresh; they show the time of the instant the page was generated only.

Programming Task Submission

To submit a solution for a programming task, you must put a header at the top of your source file, so the grading system can determine the task being solved and the programming language being used. The headers are:

for C for C++ for Pascal
TASK: task-name
TASK: task-name
TASK: task-name
LANG: Pascal

Once you have added this header, you can submit the source file. Click "Browse." A file selection dialog box will pop up. Select your source file, click "OK" to close the dialog box, and then click "Submit." In response a new web page will load, showing you status as your submission is processed. The output for a successful upload is:

You uploaded a C program for "median". The server has found the task and language header and is echoing them back to you as confirmation.
Compiling... The server is about to compile your program.
Compile successful. The program compiled without errors. If the compiler generated any warnings, they will be displayed.
Running submission test cases... The server is about to run your program on the submission cases.
All tests passed. Your program is correct for the submission cases. If your program fails a case, instead of printing this the server will display the case input, the correct output, and your program's output; spaces in your program's output will be translated to underscores for visibility.
Your program is saved for grading. Since all tests were passed, the program has been stored and will be graded.

If the submission succeeds, the submitted program replaces any previous submissions for that task. If the submission fails (the program is missing a task or language header, does not compile, or does not produce the correct answer for the submission cases), the submitted program is discarded. The previous submission, if any, is kept.

The bottom of the submission web page will have a link named "Return to contest" that loads an updated main contest page.

Analysis Mode

After the competition round has ended and results have been distributed, the grading system will be put into a special "analysis mode" to aid in understanding the results while investigating appeals. In this mode, you can submit any program you wish (via the normal program submission procedure above) and the grading system will score it using the full set of competition test data. For the first test case which fails, a full report of input, correct output, and program output is displayed. These submissions will not be saved no matter what the results are, and they do not affect the state of earlier submissions or backups. Printing and submitting new backups are disabled, but you may view code that you backed up on the system during the competition round.

In addition, zip files of submitted code, compiled executables, and program output will be available for download from the main grading system page when the system is in analysis mode. You may want to take copies of these files home with you; they will only be available during the appeals process on the day of the contest.

Output-Only Task Submission

For some tasks, you will upload only solution (output) files instead of submitting a program to solve the task. These output files are uploaded using the same submit box you use for programs, and the submission status page is similar. These solution files begin with a single line header that says

FILE task-name case-number

The task descriptions for file tasks will give complete examples of the output files.

Submission Summary

The main page displays a submission summary table under the solution submission box. The left column lists the tasks for the contest. The right column says either:

not yet submitted You have not successfully submitted a solution for this task.
submitted Aug 13 16:12:11 Your most recent successful submission for this task was at the given time. This text is a hyperlink: clicking on it will show the submitted solution.

For file tasks, the summary lists a table line for each test case. (See the table lines for "balance" in the picture above.) Custom Test Runs

You can use the "Custom Test Runs" section of the contest page to check how well your program runs when the server is enforcing the time and memory limits.

Use the file selection dialogs to select a source file and a test data input file and then click "Run Program on Test Data." The source file must have a task and language header as described earlier for task submissions. The server will compile the source file and run the resulting executable using the time and memory limits for the task. It will save the given input file as "" before running the executable. Once the executable has finished, the server will display:

The bottom of the page has a "Return to contest" link back to the main contest page.


The "Print" section of the main page has a file dialog box just like submission and the test runs. To print a text file, use "Browse" to select it and then click "Print." You will be shown a web page confirming that the print was successful. The bottom of the page has a "Return to contest" link back to the main contest page. Your printout will be brought to you in a few minutes.

Backing Up Your Files

The server will store backups of program source you submit to it. If your computer stops working during the contest, you will be moved to another computer with none of your files on it. You can then download your backups from the server to start work on this new computer. The backups are also useful if you accidentally delete something from your computer.

Each time you submit a program or file task solution, it is automatically backed up. To explicitly back up a file, use the file selection box under "Backups" to select the file to back up. You may also enter a comment in the "Comment" field. Then click "Backup." A new web page will confirm your successful backup. The bottom of the page has a "Return to contest" link back to the main contest page.

Backup Summary

Under the backup submission form, the server lists all your backed-up files in a table. Each backed-up file is listed as a table row, with the following column entries: file name used in the backup, date of backup, comment (if any), and a "remove" link that removes that file from the server.

To download a backed-up file, click on its file name in the list.

The example screenshot of the main contest page above shows one backed-up file, named soln-opt.c, submitted on Aug 13 at 16:16:29 with a comment of "This is the comment."

Logging Out

The "Log out" link logs you out of the contest server.

Compilation and Execution Environment

Compilation Command Lines

In case you want to use exactly the server's compilation command, the server uses the following command lines to compile your programs:

C gcc -pipe -O2 -o task task.c -lm extimec.o
C++ g++ -pipe -include /usr/include/stdlib.h -O2 -o task -lm extimecc.o
Pascal ppc386 -So -O1 -XS -otask -kextimepas.o task.p

As can be seen from the compilation command lines, the grading server links your program with an extra object file. This object file provides a function exectime that you can call to discover how long your program has been running. The function declarations necessary to use them are:

C int exectime(void);
C++ int exectime();
Pascal {$I}

In all cases, exectime returns the number of milliseconds that the program has used.

Exit Code

Your program must exit with exit code 0. In Pascal, this is the default: no special steps are necessary. To exit with code 0 from C or C++, return 0; from inside main, or call exit(0); to exit the program. Note that to use exit() you must #include <stdlib.h>.

Integer Sizes

The compilers provided in this competition recognize the following signed integer types:

8 bits 16 bits 32 bits 64 bits
C/C++ char short long long long
Pascal Shortint Integer Longint Int64

Note that an int in C is 32 bits, while an Integer in Pascal is 16 bits.

Random Seeding

Your programs are not allowed to be non-deterministic: they must produce the same output each time they are run on a particular input. If you want to use a pseudo-random number generator, you can get deterministic behavior by seeding it with a fixed value. For example, in C and C++ you can use srand(0); and then call rand() to get a fixed sequence of random values. In Pascal, you can set RandSeed:=0; and then use Random() to get a fixed sequence of random values.

C++ Namespaces

One difference between g++ v3 and Borland C++ is that g++ now enforces the C++ namespace conventions, which place "standard library" symbols in the 'std' namespace. Practically, this means that you must either qualify all these symbols with 'std::' (e.g. 'std::cin') or place the declaration 'using namespace std;' under your '#include' lines, e.g.:

	#include <iostream> 
	using namespace std;

Borland C++ requires neither of these steps.

Windows and Linux Are Not Identical

Although much effort has been put into making the supplied Windows and Linux programming environments as similar as possible, they are not identical. In particular, due to differences in the design of the operating systems, programs with uninitialized variables, stray pointers, or other conditions outside the language spec may work in one environment and crash in the other. The two installations will also run some of the same operations at different speeds. As such, it is important to note that the grading system runs on Linux (in an environment identical to the provided Linux installation), and it is only the Linux behavior and performance which will be used to assign points. Windows users may use the "Custom Test Run" facility of the grading system to evaluate the behavior and performance of their programs under Linux. Even for Linux users, since the grading system enforces memory limits on program execution, output sizes, etc., contestants may benefit from using the Test Run facility.

Change History

1.00 -- "First Hardcopy Version"
No content changes from v0.11
Remove edit history

Direct questions and comments to IOI'03 Scientific Committee Chair Greg Galperin.