This tutorial gives a brief introduction to the evaluation platform and how to interact with it. It shows you how to solve a simple problem. The tutorial assumes that you are familiar with the choosen programming language.
When taking the test, you will be given a number of programming problems to solve. Each problem has a difficulty rating. The problems can be solved in any order; however, we suggest you start with the easiest. You will need to write a program to solve each of the problems. Feel free to use your preferred IDE, or our online text editor. Once you have created and tested the code, you will be able to submit your code for evaluation.
After you submit the code, it will be automatically evaluated. After some careful deliberation, you will get a judgement informing you whether your code behaved as expected or not. Look at How judging is done in the help for details on the judgement process and possible judgements returned from the system.
If the judgement is Accepted, your solution is deemed correct and sufficiently fast. You may submit additional attempts at the same problem, for example after cleaning up and commenting the code, or move on to the next problem. If the judgement is not accepted, you may debug your solution (with the judgement as a general guideline) and submit an alternate solution.
You can submit as many solutions as the allotted time allows. The last solution submitted for each problem will be used in assessing your programming proficiency.
Your program should read its input from standard input and produce output on standard output. This can for instance be done using readline library / console.log().
Input will always follow the input specification (so you do not need to validate the input). Your output must follow the output specification.
We are currently using Dell PowerEdge R230 servers for judging. These are equipped with an Intel Xeon E3-1220V6 CPU running at 3.0 GHz and 8 GB RAM. A 64-bit Linux kernel is used.
We will inspect the exit code of your program. If it is non-zero, we will judge your submission as Run Time Error.
Now lets get down to business and write some code. The short tutorial below goes through the solution of A Different Problem.
You are tasked with writing a program that computes the difference between integers. Sounds simple, doesn't it? Well, as we will see, the problem still holds some small difficulties.
Now that we have determined a suitable type, we just have to read the data. Reading is done from standard input. In this problem, we should read until the end of the file (in other problems, there might be an integer at the beginning of the input, specifying how much to read, or there might be a special indicator denoting that there is nothing more to read). Using the readline library, this can be done as below:
Now that we've read the input, it's time to actually solve the problem. Since 0 ≤ a, b ≤ 1015, we have that −(1015) ≤ a−b ≤ 1015, which means that there is no danger of overflow involved in just subtracting the two numbers a and b. Then, we can just take the absolute value by using the Math.abs function.
Finally, it's time to print the result. Using console.log (assuming the int variable res holds the result):
Now we are basically done, all that remains is to combine the above parts.