Code under source
directory.
Test your code against the test case (in.txt
and oracle.txt
) with CTest:
ctest --output-on-failure
or, use tool/tester.py
directly:
./tool/tester.py <executable> <input file> <oracle file>
or, directly use the executable produced by CMake, e.g. like this:
./build/Codeforces < ./source/in.txt
Manage your code with this directory structure:
source
: current working codetemplate
: template codearchive
: history code
And use tool/archiver.py
to automate operations:
# To backup `source` to `archive`:
./tool/archiver.py backup
# To restore from some directory under `archive`:
./tool/archiver.py restore
# To reset `source` with `template`
./tool/archiver.py reset
# To backup `source` to `archive` and then reset `source` with `template`
./tool/archiver.py archive
Note: use archiver.ini
or command line arguments to specify paths.
Here is the process of a typical use case:
- Set
archive=archive/Codeforces/E136
inarchive.ini
- For each problem
P
in {A, B, C, D}:- Copy sample input and output to
source/in.txt
andsource/oracle.txt
- Solve the problem in
source/main.cpp
- Archive
source
to a subdirectory underarchive/Codeforces/E136/
by./tool/archiver.py archive
(the tool will interactively ask for the problem ID, and use it to name the subdirectory)
- Copy sample input and output to