Competition Environment¶
In this section, you can find all the information about what the competition environment on Petlja looks like and how to use all the functionalities it offers.
If you are a teacher and want to create your own competition, you can check out this guide.
Overview, Information, and Submitting Solutions¶
When you access a competition, you will see a list of problems on the left side. By clicking on a problem, you access each individual problem.
When you click on any problem, below the problem statement you will see a list of available programming languages in which you can write your solution. Choose the language you use. When you have written a program you are satisfied with and want to submit, select the entire text of the program in the editor where you write your code (you can probably do this by pressing Ctrl + A), copy it (Ctrl + C), then click in the window below the problem statement intended for your solution and paste your program (Ctrl + V). If you select the program text with the mouse, make sure to select ALL THE TEXT of the program (a common mistake – it is enough to omit just the first or last character of the program text and the copied “program” will not be able to run at all). Another way to submit your program for testing is to upload the file from your computer by clicking “Upload” and selecting the desired file. When you have placed your program in the designated area, click the “Submit” button. If everything is fine, a message should appear next to that button indicating that the solution was successfully submitted, and in the lower right corner, a message will appear indicating whether your code was tested (see image below).
Keep in mind that once you submit code, you can only submit it again after a certain period of time. This time is determined by the competition rules and may vary from competition to competition. To find out what this period is, you need to click on “Information,” where, in addition to the minimum time between submitting different solutions, you will also see other conditions of the competition you are participating in. First of all, you will see whether there are penalty points, how the grading is done, which languages are available, whether the best submitted solution or the last submitted solution is scored, as well as all other relevant information.
When you click on “Overview” (above the problems), you should see a section called “My Points,” where you can see the points you have earned if this is allowed in the competition, and below that, a section “Submitted Solutions,” which contains data about every code you have submitted. In the result field, depending on the competition you are participating in, you may see the number of points you have earned, a question mark (if it is not possible to see the results in that competition), or CE (compilation error) if there was a compilation error.
Also, by clicking on the magnifying glass, you can see how your code performed on the test cases if the competition you are participating in allows contestants to see the results of all test cases. Your code may produce different results on those cases, and accordingly, it will have different statuses. Possible statuses are marked with the following labels (and are also located in the lower left corner of the Arena):
OK - ok (the program produced the expected output within the allowed time and memory)
WA - wrong answer (the program output is different from the expected)
TLE - time limit exceeded (the program exceeded the time limit)
MLE - memory limit exceeded (the program exceeded the memory limit)
RTE - run-time error (the program attempted something not feasible and therefore could not complete execution. Examples include division by zero, calculating the square root of a negative number, accessing a non-existent array element – out of bounds, etc.)
NT - not tested (in some competitions, testing stops after the first case where the status is not OK, and in that case, the remaining cases are not tested and are marked with this status)
? – the result is hidden, i.e., the competition is set so that you cannot see the results on (some or all) test cases
means that testing is pending, i.e., our system has not yet evaluated your code
CE - compilation error (unsuccessful compilation) – if CE appears next to the code you submitted, you can click on the magnifying glass to see why the compilation was unsuccessful. In that case, you should see a message similar to the one in the image below. Tip: if you received this result, check whether you selected the correct programming language before submitting the solution for evaluation and whether the entire code was submitted for evaluation.
Keep in mind that in some competitions, the only test cases for which you will be able to see the result are those included in the problem statement, and in all other cases, you will not be able to see how your code behaves. Therefore, a question mark will appear next to them, meaning the result is not available to you.
On this same page, below the described “My Points” section, there is a section called “Submitted Solutions.”
Here, for each solution you have submitted, you can see when the solution was submitted, for which problem it was submitted, which programming language was selected before submission, and finally (if the competition is set so that results are public) the result obtained for that solution. By clicking on the magnifying glass at the end of the row, a window with details opens. Depending on the type of problem and the scoring method, these details may look different. We will describe the appearance of this window for only two types of problems that contestants most often encounter at the beginning.
Problems where each test case is scored separately
For this type of problem, if the results are public (in the trial competition for testing the competition environment, this is problem A), the details window for a solution looks like the following image.
Here, for each test case, you can see what answer your solution produced on that test, how many points that answer carries, how long the program ran, and how much memory the program used during execution.
Problems with test cases grouped into subtasks.
For this type of problem, each test case is not scored individually, but groups of test cases called subtasks are scored. To earn the points assigned to a subtask, your program must solve all test cases in the group correctly and on time. This ensures more objective grading for several reasons; for example, it is harder to earn points by guessing results. This is especially evident in problems where there are very few possible answers (e.g., only “yes” or “no”), where, if scoring were done on individual tests, a program that only prints “yes” (and essentially does not solve the problem at all) would earn some points, while with group scoring, such a solution earns no points. In the trial competition for testing the competition environment, the problem of this type is C, and for it, the solution details window looks like the following image.
Here, for each subtask, you can see the number of points earned for that subtask (large number on the left), then how many test cases from that subtask had which status, as well as the execution time and memory used during execution. In the specific case from the image, for example, the third subtask contains six test cases and brought 30 points (all 6 cases received the OK answer, and there were no cases with a different answer, as shown by the zeros below those answers).
Input and Output¶
When working on problems and submitting solutions, be sure to pay attention to the expected format for input and output values as specified in the problem statement. As you know, testing on our system is automatic. Thanks to this, we can test a large number of submitted solutions in a short time. Unfortunately, automation also means that the testing is quite strict.
IMPORTANT!!!
That is why it is very important that your program prints exactly what is required (without additions) and exactly as required. Otherwise, it may happen that a solution that is essentially correct is graded as incorrect because the correct result was not recognized as correct due to the way it was printed. For example, if the problem states that the output should be a single integer, your program is expected to print only that integer. If your program prints, for example, “the correct answer is: 5” instead of just 5, your solution may be graded as incorrect, even though you may have conceptually solved the problem well. The same applies if you use lowercase instead of uppercase letters and vice versa (for example, if you need to print “yes” but your program prints “Yes” or “YES”).
Also, your program should read the input exactly as it will be provided during automatic testing. For example, if it is stated that several numbers will be given in one line separated by spaces, then your program should read them that way. When reading input, the program should not print messages like Enter N for the reasons already explained. When manually testing your program (before submitting it for evaluation), be sure to enter the data exactly as described.
Test Code, Questions, Notifications¶
The Arena offers you some other important features that will help you during the competition. When you click the “Test Code” button located below the problems in the menu on the left, you will have the opportunity to see, without submitting your solution for checking, what the output values are for a given input. You need to select the programming language again, copy your code into the upper window, and then you can enter the input values in the right window, click the “Run” button, and in the left window, you will see the result of your code execution as well as the execution time and memory used. Code tested in this way will not be included among the submitted solutions.
Below the “Test Code” button, there are the “Questions” and “Notifications” buttons. When you click on “Questions,” you will have the opportunity to ask the competition organizer a question, and you will see the answer there when the organizer sends it.
Below “Questions” are notifications. They are important because through notifications, the competition organizer sends information relevant to all contestants, so our advice is to regularly check notifications and, before asking a question, see if the notification already contains the information you are interested in.
Finally, our main advice is to try out all the features that the Petlja competition environment offers and to feel free to click on “Questions” during the competition and ask anything that is not clear to you (the worst that can happen is that you get the answer No comment, which means that the competition organizer considers that they cannot answer that question). Besides that, it is important to click on “Notifications” from time to time so you do not miss any important information.