-
Notifications
You must be signed in to change notification settings - Fork 1
Problem packages
Problem packages are a standardized way to add algorithmic problems to IdLearn. They are saved in the /home/user/.idlearn/problems/ directory and the user can edit these files. This allows for modding and exchange of custom problems between users.
The problem package is a directory with the following recommended structure:
packageDirectoryName
├── config.yml
├── makefile.in
├── makefile
├── doc
│ ├── statement.txt
│ ├── example1.in
│ ├── example1.out
│ ├── example2.in
│ └── example2.out
└── prog
├── generator.cpp
├── model.cpp
└── checker.cpp
-
config.ymlcontains important metadata like the title, difficulty, path to the statement and files containing examples, names of files containing input and output and test configuration. All very important and mandatory. -
makefile.inprovides various filenames for the scripts. This is entirely modifiable without any negative effects on the application. -
makefileprovides scripts for convenient building of executables or auxiliary files, the names of which are in makefile.in. -
doccontains files related to the presentation of the problem: the statement, and an example input and output, although the existence of this folder isn't necessary and is only for structural organisation. -
progcontains files related to testing submitted solutions. Similar todoc, this folder is not necessary.-
generatortakes one argument, a natural numbernand outputs then-th test for that problem to stdout. It is recommended that the tests be generated pseudo-randomly. -
modelreads the input of a test from stdin and outputs useful information to stdout. "Useful information" may be either the correct output to that test, if it's unambiguously defined, or data which will help verify the correctness of the user-submitted program in some other way, if there may be many correct outputs. -
checkerreads the input, user output, andmodeloutput from files and decides whether the user-submitted solution is correct on the given test, or not, outputting precisely "OK\n" if and only if the output is correct.
-
For modifiability purposes, in order to ensure correct application operation and the highest possible efficiency, the following restrictions on user-created problem packages are put in place:
-
It is currently only required that
config.ymlandmakefileare present in the package. -
The
config.ymlmust provide the following information:- The
titleof the package - The estimated
difficultyof the problem (Easy/Medium/Hard) - Path to the
statement - Prefix of the path to the input files (
testInput) - Prefix of the path to the output files (
userOutput) - IDs of tests to be run (
testData) - The
expectedTime(run your own solution with expected time 1.00, check the result and put that in instead), andexpectedMemoryusage.
And optionally
- A list of
examples, each consisting of a path to theinputand theoutputfiles for that example.
- The
-
The
makefilemust provide the following goals:-
make cleanmust result in a zero exit code (no additional requirements). -
make allmust build all necessary executables. -
make input TestID=Xmust create a file calledtestInputXwheretestInputis the same path as the one inconfig.ymlcontaining the input to theX-th test in the problem package (usually this means executinggenerator X). -
make modelOut TestID=Xmust create the output of themodelprogram fortestInputX. -
make check TestID=X -smust use the user output saved in fileuserOutputXwhereuserOutputis the same path as the one inconfig.yml, to check the correctness of the solution, outputting the string"OK\n"(without quotation marks) to standard output if and only if the contents ofuserOutputXare correct for the giventestInputXandmodeloutput.
-
-
The test input and output prefix file paths must be consistent between
config.ymlandmakefile(ormakefile.in). -
For purposes of concurrent testing, no files in the package named
testInputXoruserOutputX, wheretestInputanduserOutputare the same as inconfig.ymlandXis a positive integer, may contain information important for the correct functioning of the package.