Running libinteractive problems
libinteractive is an easy way to write interactive problems. The process to compile, run, and test programs is slightly different to the one you are used to, but it is simple. The specific steps depend on the operating system you are using.
First, choose your operating system and the language you will be using with the dropdown that is shown in the problem statement. Then, follow the steps that correspond to the operating system you are using:
Windows
- Extract all files in the template into a folder. Open the Commandline
(Windows+R, type
cmdand press Return), and navigate to the folder you just created. - You must have previously installed Code::Blocks
(make sure to install the version that says MinGW) and run it at least once.
- If you want to use C or C++, simply open the Code::Blocks project file
that is included in the folder you just extracted. You can ignore the
rest of the steps. To try other test cases, try modifying the
sample.infile that is included in the project. - If you are using Java, you must install the JDK.
- If you want to use Pascal, you need to install Lazarus and have launched it at least once.
- If you want to use Python, you need to install Python 2.7.
- If you want to use C or C++, simply open the Code::Blocks project file
that is included in the folder you just extracted. You can ignore the
rest of the steps. To try other test cases, try modifying the
- To compile all required programs, type
run(orrun.bat). This will also run your code. Remember that the problemsetter program expects to read the case from stdin, so you either need to type it on the commandline or redirect stdin (run < input.in). - To test your solution with a test case, write
test(ortest.bat). This is equivalent to runningrun.bat < examples\sample.in.
Linux/Mac OS X
- Extract all template files to a directory, open the terminal and navigate to the recently created directory.
- It is recommended that you have the following packages installed:
make,gcc,g++,fpc,pythonyopenjdk-7-jdk. - Write
maketo compile all needed programs andmake runto execute your code. Rembember that the problemsetter program expects to read a test case from stdin, so either type it on the terminal or redirect stdin (make run < input.in). - To test your solution against a test case, write
make test. This is equivalent to runningmake run < examples/sample.in.
General notes
- To correctly solve the problem, you must only submit the file that the website tells you. Don't send any other file or it will result in a compilation error.
- Some problems will have extra test inputs beside
sample.in. Try to make your code run correctly with all those cases. You can try them out by running eitherrun < examples/file.inormake run < examples/file.in, depending on your operating system. - To get all possible points in a problem, your program must solve all possible
test cases, even some not included in the
examplesfolder. Try to think of additional test cases, run your code with them and verify that the result is correct. Good luck!