2002 International Olympiad in Informatics
Version: 1.03
== IOI 2002 Competition Rules ==
These Competition Rules include the Competition Procedures and Judging Procedures, which the host is obliged to send to invited countries four months prior to the competition. Minor changes to these rules will likely be made; the final version will be distributed in the first GA meeting of IOI 2002.
[Competition Dates]
IOI 2002 will take place from Sunday, August 18 (Arrival Day) to Sunday, August 25 (Departure Day). The First Competition Day is Tuesday, August 20, and the Second Competition Day is Thursday, August 22. On each competition day contestants will be given three tasks to complete in the five hours from 9:00 to 14:00.

There will also be a practice competition round on Monday, August 19. All contestants MUST take part in the practice competition round.
[Competition Equipment]
The specification is: a PC with a 1.7 GHz Pentium 4 processor, 256 MB RAM, a standard US keyboard, a mouse, and a color screen. If the model information is changed, this section will be updated, and announcements will be made on the web site and the IOI mailing list.

Blank paper and writing utensils will be provided. Contestants may NOT take any material such as computing equipment (including calculators, organizers, PDAs, computers, ...), books, manuals, written or printed materials, diskettes, CD-ROMs, or communication devices into the competition area. A contestant who is in possession of this type of material in the competition room may be disqualified.
[Programming Environment]
The computers have a dual-boot installation of Debian GNU/Linux 3.0 'woody' and Windows XP. In both the Linux and Windows environments, the programs installed for the competition are set up in such a way that they can be found in the users' path (i.e. no extra setup is needed to use the tools). Both the Linux and Windows platforms include:
GCC compiler version 2.95.3, and
Freepascal (fpc) compiler version 1.0.6.
These are the official compilers for IOI 2002.

Newer versions of software may be installed as necessary to resolve hardware problems and/or software compatibility/bug-patch issues. If so, the changes will be announced on the competition web site and the IOI mailing list. The contestant should be familiar with the programming package of his/her choice, including the use of libraries or units. The contestant should be able to execute programs, change the working directory and manage files, and use a web browser.

Similar installations will be used for the computers in the translation computer room. Windows installations include MS Word with some multi-lingual support and PowerPoint. In the Linux environment, TeX will be provided.

Additional tools may be available for assisting the contestants with the tasks. Documentation about the computing environment which does not reveal the nature of the tasks will be made available on the competition web site.
[Competition Tasks]
All of the tasks in IOI2002 are designed to be algorithmic in nature. There are two types of tasks: (1) tasks for which a solution comprises a single source file of a computer program, and (2) tasks for which a solution comprises a set of "output" data files.

Efficiency plays an important role in some tasks. Whenever efficiency of algorithmic computations is important, there will be at least one grading input for which some correct but inefficient programs can also score some points. It is important, therefore, for contestants to attempt a task even if the contestant does not know how to solve the hardest possible test cases.

(1) Tasks for which a program source file is requested as a solution:

When a program source file is required as a solution, the program source provided by the contestant must be contained in a single source file. The task documentation will specify:
the input and output data format and value ranges,
the resource limitations for the computations (e.g. cpu time, memory),
any other constraints on the program behavior, and
the comment tags required in the source code so that the grading system can identify the task and programming language.
The submitted source program must be smaller than 1 MB and the evaluation server computer must be able to compile it in less than 30 seconds. Submitted programs which do not meet these constraints will be rejected by the submission system and the contestant will be notified.

(2) Tasks for which output data files are requested as a solution:

There may be tasks for which input data is given to the contestant and the contestant is required to produce only the output data as an answer. If the contestant writes programs to help determine the output data, the programs should not be submitted with the solution. The input data will be provided in ASCII text files. For these tasks, the task documentation will specify:
the structure of the input and output files, and
the full set of official input files.

Input and output data:

In all tasks, input and output data consists of a sequence of items. An item is a string of printable non-white-space characters (ASCII code from 33 through 126). An item may represent an integer or a general string; the meaning of each item will be given in the task specification.

Spaces and end-of-line characters separate items. The format of the input data will be given in the task specification. The output data files should be formatted strictly according to the task-specific instructions. However, the grading system scores output files using C++ streams in such a way that extra white space (spaces and end-of-line characters) between or around items is ignored.


In both Windows and Linux, the environment will be provided with a directory created for each task. Each directory will be named after its task and will contain any required task-related materials. As an example, consider a competition round with three tasks, named "number," "string," and "red." In Linux each contestant's home directory will have the three subdirectories ~/number/, ~/string/, and ~/red/; and in Windows each computer will have the folders C:\ioi\number\, C:\ioi\string\, and C:\ioi\red\. All provided files relating to the "string" task will be contained in the ~/string/ subdirectory in Linux and in the C:\ioi\string\ subdirectory in Windows.
The competition computers will be available for practice during hours that will be announced at the competition. All contestants must take part in the practice competition round on Monday, August 19. Before each competition round, the computers will be assigned randomly to the contestants (with a different assignment each time).
A curfew will be in effect beginning with the start of a GA meeting where tasks for a competition day are presented and approved, and ending on the following competition day after the start of the competition. During the curfew the contestants are not allowed to communicate by any means, direct or indirect, with any people who attend this meeting. The contestants and the GA meeting participants must obey any instructions which limit the area where they are allowed to be. The GA meeting participants are not allowed to communicate task-related information to anyone not at the meeting before the end of the curfew.

Any contestant breaking the curfew may be disqualified. If some other person associated with a national delegation breaks this rule, then all contestants of that delegation may be disqualified.
[Competition-time Procedures]
Starting the competition:

Contestants will be taken to the competition hall before the competition starts. A randomly chosen computer is designated to each contestant (with a different assignment each time). The computer will be powered up and will display a menu from which the contestant may choose to boot either Linux or Windows. The competition envelope containing the task definitions and other necessary information will be in front of the computer. Contestants are not allowed to touch the keyboard or open the envelope until the start signal is given. At the starting whistle, contestants may open their envelopes and use their computers.

Logging in is not necessary for Windows. Under Linux, contestants should log in as:
username: ioi        
password: ioi        


During the first hour of competition, contestants may submit written questions concerning any ambiguities or points needing clarification in the competition tasks. Questions must be submitted on the provided Clarification Request Forms, expressed either in the contestant's native language or in English. If required, delegation leaders will translate their contestants' questions to English after they are submitted before sending the questions to the Scientific Committee.

The Scientific Committee will answer every question submitted by the contestants. Since this may take some time, contestants should continue working while waiting for the answer to their questions. The only responses which will be given are "YES", "NO," and "NO COMMENT;" contestants should phrase their questions so that a yes/no answer will be meaningful. Contestants will not be involved in or exposed to discussion regarding their questions.


Contestants may ask the support staff for assistance at any time. The staff members will not answer questions about the competition tasks, but will deliver Clarification Request Forms and printouts, help locate toilets and refreshments, and assist with computer problems.


Contestants will be able to print via a facility provided in the competition environment. The support staff will deliver the printouts to the contestants; there might be a small delay before printouts are delivered. Contestants should not leave their computer to find printouts.


Contestants will be able to make and retrieve backups through a facility provided in the competition environment.

Test execution:

For tasks that require programs as solutions, a contestant will be able to submit a solution along with an input file for test execution. The test execution system will compile and execute the program under Linux, enforcing the resource limitations for the particular task. The program output, the execution time, and possibly error messages will be displayed. A contestant can have at most one test execution in progress at a time; until a test execution has completed further submissions will be blocked. The test execution facility will not be available during the last 5 minutes of the competition.


Contestants will be able to submit their solutions through a facility provided in the competition environment. For tasks which require output files as solutions, the submission facility will validate the format of the output file submitted, accepting the output file for grading if it passes. For tasks that require programs as solutions, the submission facility will verify that the program compiles and obeys the stated limits on source code size and compile time, and will run the program on a simple test case that is given in the task description, enforcing the relevant run-time resource constraints. If the submission produces the correct output, then the submission is accepted for grading.

Contestants may submit any number of times for each task; each accepted submission replaces any other submissions of that task by that contestant. The last accepted submission by a contestant for a task is officially graded in a separate process and contestants will not be informed about the results until after the competition.

Ending the competition round:

Warnings will be given with 15 minutes remaining in the round (3 short whistles and a verbal announcement "15 minutes"), 5 minutes remaining (2 short whistles and a verbal announcement "5 minutes") and 1 minute remaining (1 short whistle and a verbal announcement "1 minute"), and the end of the round will be announced (3 long whistles and a verbal announcement "end of competition round").

At the announcement ending the round, contestants must immediately stop working and put their keyboards on top of their terminals without switching off their computers. Contestants should then wait at their desks without operating their computers or touching anything on their desks; an additional announcement will be made instructing them to leave their tables and exit the competition hall. At this point, contestants may take with them the contents of their competition envelope.
The grading system evaluates the submitted tasks after the competition round. For tasks that require programs as solutions, the submitted source files will be re-compiled under Linux, enforcing the source file size and compilation time constraints. The compiler options for Pascal programs are "-O2 -So -XS" and the compiler options for C and C++ programs are "-O2 -static -lm".

The grading system will then execute the compiled program under Linux, enforcing the task-specific run-time resource constraints. Typically, there will be a CPU run-time limit and a limit on total memory use. Every limit applies independently for each test case; if any limit is exceeded, no points will be awarded for that test case. The actual limits will be specified in the task materials.

If the submission facility accepts a program, that only means that the compilation was successful and the program correctly solved the simple test case within the resource constraints, but no more. In particular, it does not mean that the program would obey the resource constraints when given different input.

The IOI 2002 schedule will specify the times when the grading results and evaluation data used for grading will be made available to the delegations, and when grading appeals are to be submitted to the Scientific Committee.
[Other Information]
A contestant
trying to interfere with other contestants' activities,
trying to break the installations or evaluation facilities,
trying to harmfully interfere with the running of the competition in any way, or
trying to communicate in any way during a competition round with anyone other than the competition staff
will be disqualified from the competition.

The competition computers are connected via a local area network for submitting solutions, running test executions, making backups, and printing. Contestants are not allowed to access the network for any other purpose or with any tools other than the tools provided by the organizers. Even sending a single 'ping' command is strictly prohibited. The competition staff should be contacted for help with any suspected network problems. Also, contestants are not allowed to make any material accessible to the network from their computers. The competition facilities are provided over secure connections. The network traffic is monitored and logged during the competition; a contestant breaking these rules will be disqualified.

Submitted programs
are not allowed to access the network,
are not allowed to fork,
are not allowed to create files other than those required in the task definition,
are not allowed to attack the system security or the grader,
are not allowed to attempt to execute other programs,
are not allowed to change file system permissions, and
are not allowed to read file system information other than the input file given in the task description.
A contestant whose program attempts any of the above will be disqualified.