Competition Rules

These Competition Rules cover Tasks, Competition Procedures and Grading Procedures in APIO 2012. Delegation Leaders have the responsibility of ensuring that all members of their delegation fully understand these rules and abide by them.

1 Task and Data

All tasks in APIO 2012 are designed to be algorithmic in nature, and they are all in the traditional programming type.

1.1 Task

Solutions comprise a single source file of a computer program which reads data from the standard input (stdin) and writes its answer to the standard output (stdout). The task statement will define:

  • the task to be solved,
  • the input and output data formats,
  • the input value ranges (when applicable),
  • the resource limitations for the computations (e.g. CPU time, memory limitations),
  • elements of the grading criteria (e.g. "In test cases worth 50% of the full score, N <= 100"),
  • any other constraints on the program.

1.2 Input and output data

In all tasks, input and output data consist of one or more lines, each ending with an end-of-line character, including the last line. The end-of-line character in Linux is represented by the single character '\n' (ASCII code 10). Each line contains one or more space-separated items. An item is a string of printable non-white-space characters (ASCII code from 33 through 126, inclusive). An item may represent an integer or a general string; the meaning of each item will be given in the task description.

The format and limits for input and output data will be specified in the task description. The output data should be formatted strictly according to the task-specific instructions.

1.3 Stack Limitations

Whenever any submitted program is executed through the contest system, the stack size will only be limited by the memory limit for the corresponding task.

Competition Procedures

All contest machines must be installed to be capable of accessing Internet. Contestants submit solutions to the APIO 2012 Competition Server via a web browser.

For all tasks of APIO 2012, feedback is enabled. For every submission the feedback is being prepared. However, submissions received in the last minute of the contest might not receive feedback. The submitted program then enters a queue for evaluation. Please keep in mind that the program can stay in the queue any time from a few seconds to several minutes. When its turn comes, the contestant's program will be evaluated on some of the official test cases. After the evaluation is done, the Competition Server will show to the contestant a summary of their results on the executed test cases.

No information on how the test cases are grouped together or their assigned score will be given to the contestant.

No information on the actual data, the output produced by the contestant solution or any other execution details will be given to the contestant.


The submitted source files will be compiled under Linux, enforcing the source file size, and compilation time and memory constraints.

3.1 Test case

If the submitted solution compiled correctly, the grading system will, at some time later, execute the compiled program under Linux, enforcing the task-specific run-time and memory resource constraints with several inputs.

A test case refers to each time the solution is executed with a different input. For each test case the resource constraints will be enforced. If a program exceeds its allotment of any resource, the program is terminated and the test case is marked incorrect, without regard to any output produced.

If the program produces an output within the specified resource constraints, the output will be checked to verify its correctness.

3.2 Test set

A test set consists one or more test cases. The score for a test set will be assigned if and only if the program produce an correct output within the specified resource constraints for every test case in the set.

The purpose of a test set is to assess a well-defined characteristic of a program in a reliable and robust way. Such a characteristic could focus on, for instance, efficiency or special corner cases.

3.3 Score

The final score for each task will be the maximum of the following:

The sum of the scores of test sets for any submission.