Optil.io help

Here you can find basic information about using OPTIL.io. On the following pages you can also find information about:

If you have any questions that are not replied on this page you can always contact us.

Preparing solution

OPTIL.io is a platform where you solve optimization problems. It means that you have to implement an algorithm that selects the best solution from many correct solutions. Each problem defines a so-called objective function which describes the value that should be minimized or maximized and your task is to find the solution for which the value of the function is as large or as small as possible. For example take a look at the Traveling Salesman Problem. In this problem you have to find a trip plan for the salesman that visits all available cities and is as short as possible. In other worlds you have to find the trip with minimal length.

Each problem published at this platform in its description has definition of the objective function that you should minimize or maximize and the description of the format used to provide input data and the expected format of output data. For example, take a look at the tutorial problem. You have to write a program that reads one integer number and outputs the other one. Your program has to read all input data from the standard input (i.e., keyboard) and write to the standard output (i.e., screen console). Keep in mind that we verify your program automatically, so it is very important that you are not allowed to print any additional text that is not defined in the problem description. For example, do not print information messages such as Your result is equal to or Please input the first number.

An example solution that solves the tutorial problem is presented below. More examples how to solve this problem in other programming languages is presented on the page presenting methods for handling signals.

#include <cstdio>

using namespace std;

int main()
  int n;
  scanf("%d", &n);
  printf("%d\n", n-1);
  return 0;

The tutorial problem is very easy, to make it possible to present you the platform. It is very easy to find the optimal (maximal in this case) solution. However, other problems are much more challenging, and for most test instances it is not possible to find the optimal solution. That is why your solution receives points based on the comparison with the best solution submitted by other users and not with the best solution possible. For detail, see the description of the scoring procedure. .

Submitting solution

You should prepare the solution in any of the supported programming languages. Then you should submit the source code that is compiled on the server and evaluated. To submit the code use the Submit tab that is available on the page with problem description. The easiest method to submit the code is to select the file containing it from the hard drive. However, you can also paste it directly into the submission form.

The submission of the code is much easier if the whole code is in a single file. However, if needed, you can separate it into several files and submit it in an archive containing CMake file defining how to build your code. The you should submit it as an archive in TGZ format (with .tgz extension). Make sure that the make program will generate an executable file with the name exactly the same as the name of the archive. It should be generated in the root directory of the archive. You can also send a TGZ archive without CMake files with a statically compiled binary, located in the root directory of the archive, with the name exactly the same as the name of the archive. For example the binary located in solution.tgz should be named solution. If you want to submit the archive with several Python files name it solution.py.tgz where solution.py is the name of the main file.

After you submit a solution you can check the status of evaluation at the My runs tab on the problem description screen. The most important columns are status of the evaluation and its scores received for all test instances defined for this problem.

Handling time limitt

For most problems there are two time limits defined. After the first, shorter time limit your solution receives SIGTERM Linux signal and has a possibility to output the best solution found so far. After a bit longer time it receives a SIGKILL signal, it is terminated by the operating system and receives Time Limit Exceeded signal. Catching the SIGTERM signal is the preferred method for checking the time limit because it is independent on the method of time measurement. For some, simple tasks when the time limit is equal to several seconds it can happen that the SIGTERM is not sent before SIGKILL. You will find information about such a case in the description of scoring procedure in the problem description.

You can find examples how to handle SIGTERM in several popular programming languageshere.

Submission status

Each solution of the problem is scored based on some set of test cases. For each test case, it can receive one of the statuses described below. Each solution also receives the aggregated status.


The most wanted status. If you receive it, that means that your solution solved the test case correctly. However, it does not have to be the best solution possible. The quality of you solution is presented using score value which is described for each problem separately in the problem description in the scoring section.

Time Limit Exceeded

Each problem has a time limit defined (equal for each test case). If your program receives this status, it means that on some test case it executed longer than the time limit. You should reduce thecomputational complexity of your program. The duration of the time limit is described in the problem description in scoring section

Memory Limit Exceeded

This status means that your program uses to much memory and exceeded its limit. Very rarely it can happen that you program receive Runtime Error instead of Memory Limit Exceeded status if it allocates the memory very quickly.

Output Limit Exceeded

Your code generated too long output. This status usually means that your algorithm has some infinite loop that continuesly outputs some text. However, sometimes you can get this status when you incorrectly solve the problem and for this reason output too many data.

Processes Limit Exceeded

Your code creates additional processes. You are not allowed to do this!

Runtime Error

This status means that your program did not complete successfully. It crashed by throwing some exception or returning non-zero status from the main function. There could be a lot of reasons for that, for example dividing by zero or using a null or invalid pointer.

Wrong Answer

This status means that your answer is incorrect. Please read carefully the description of the format that should be used to output the solution and check the problem description to make sure that you understand it correctly.


Each solution is evaluated using some set of test cases. Usually there are between 10 and 100 test cases and the submitted solution is evaluated using each of them. The scoring procedure is defined specifically for each problem and is described in the problem description in the scoring section. Based on the scores received on each test case the aggregated, total score is calculated. For each test case, the best solution among all submitted receives 100 points divided by the number of test cases. The worst solution receives 0 points and all others the amount proportional to the best and the worst solution. Finally, the points awarded for each test case are summed to form the total score. Beware that using this scoring procedure your score can change in time when somebody submits a new solution.


Finally, it is worth quoting the motto presented on Timus online judge website called The First Law of Online Judges: For every problem there is a solution which is simple, fast, and wrong. We wish all users of the OPTIL.io platform to avoid such solutions as often as possible.