Welcome to Algotester!
- What is Algotester?
- What should I do to start using Algotester?
- I wanna try to solve some simple problems, and if I like it maybe some more.
- I got a "Wrong Answer" on the problem "A plus B".
Wrong Answer |
There is a valid test case on which your solution result is different from the judge`s solution result. |
Runtime Error |
Program execution finished unexpectedly (run-time error). |
Time Limit |
There is a valid test case on which the program execution time exceeds the limit specified. |
Memory Limit |
There is a valid test case on which the program memory consumption exceeds the limit specified. |
Compilation Error |
The compiler is unable to compile your code. |
Accepted |
This is the only verdict that is good for you - the program passed all test cases and is accepted by the judge! |
- Can I compare my progress with other members?
- Problem Archive is cool, but what if I want to participate in real contests?
- I wanna learn more stuff, but how?
Very easy - Algorithmic College is organized in Lviv National University every Thursday, where you can learn different algorithms and discuss problem-solving with fellow members. More details on the "College" section.
-
Examples of problem "A plus B" solutions written on available programming languages:
-
C++
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; return 0; }
-
C#
using System; class Algotester { public static void Main(string[] args) { string[] line = Console.ReadLine().Split(' '); int a = Int32.Parse(line[0]); int b = Int32.Parse(line[1]); Console.WriteLine(a + b); } }
-
Java
import java.util.Scanner; public class Algotester { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); System.out.println(a + b); } }
-
Pascal
var a, b : integer; begin read(a, b); writeln(a + b); end.
-
Python 3
a, b = input().split() a, b = int(a), int(b) print(a+b)
-
F#
open System let sum = Console.ReadLine().Split() |> Seq.map System.Int64.Parse |> Seq.sum printfn "%d" sum
-
C++
- On the right menu open section “Problems”. This section contains all the problems you have created or been involved in creating.
- Click on “Create”.
- Enter problem name, specify limits (time limit, memory limit, output limit).
- Specify checker – a program that checks if the user`s answer is correct. In most cases, you only need Token CheŃker. (See more about checkers below.) The field “Main solution” and “Validator” can be left empty for now.
- Now section “Problems” should contain the created problem.
- By clicking the name of the problem you can start editing your problem.
- On the tab “Statements” you can add problem statements on different languages. To add an English statement you should perform the following steps:
- Click on the “Create” button, enter the English problem name.
- Open the created problem statement from the list of all statements.
- Enter the problem statement. Conveniently, the statement is divided into multiple parts: Description, Input, Output, Limits, and Notes. You can use latex for a statement mark up.
- Return to the statements list and click “Submit”.
- To view your statement, click “View” next to the statement.
- Please, follow our guildelines on how to write problem statements.
- On the tab “Sources” you should add two source files:
- Problem Solution on any available programming language – source code which that will be used by the system to verify user solutions.
- Validator – a very simple but important program, written on any available language, which should read a single test case and check if all given values are valid in accordance with the problem statement. In case of valid test case the program must output nothing, and in case of an error write to console short explanation of what is wrong. Check out validator for problem Sweet Candies. After creating a solution and validator they should be specified as main for the problem. This can be achieved by moving to the “Home” tab, clicking on “Update” and specifying the solution and validator.
- On the tab “Tests” you can add test cases, on which a user solution will be tested against your main solution. To add a manually created single test, click “Create” and then choose “Manual test”. After then enter a short test description (like “First sample”, “Max-test”, “Very tricky test” etc.), specify whether you want this test to be included in the problem statement as a sample, enter the input and expected output and click “Create”. To generate a test using a program, you should create a generator (more details about generators below).
- After entering all the data mentioned above, go back to the “Problems” section, check the problem you just created and click “Submit”. In case of the successful creation of a problem you shall see “Ready” label next to the problem. Otherwise, on the "Result" problem tab you can see the detailed explanation of what is wrong with your problem.
Generator
- Generator - a program that allows you to automate the process of test case creation. This program is a regular console application that consumes parameters and prints to the standard output test case. For example, a generator can take a parameter maxN and print test case with N being chosen randomly between 1 and maxN. Here is an example of a generator to problem Elephant Coach. Please note that you may want to use the same generator with the same parameters for multiple test cases, that's why the first parameter is always test case index so that you can perform srand (test) or anything else of that kind.
- To add a generator move to the "Sources" tab and add source code with type "Generator". To add generated tests, move to the "Tests" tab, then click "Create", then choose "Generator test". After that specify the test description, number of tests, generator parameters, and the generator itself.
Checker
- Checker - a program that decides if user output is correct. For most problems, you can use the standard system checkers: Token Checker (checks if the output tokens, obtained by dividing output into parts separated with whitespace characters, coincides with the main solution output) and Double Chacker (checks if two values are equal with the specified precision).
- But sometimes some problems may have different correct outputs for test cases, that is when you have to create your own checker. Checker is a console program which will be passed three parameters: test case input, main solution output to that input, user output to that input. In case of incorrect user output, the program must print the reason for that, otherwise, the program must print nothing. Here is a checker example for problem Sweet Candies.