This repository automatically generates a directory for solving a problem from CodeForces given the name of the problem. The directory contains:
- All test cases of the problem
- A solution file based on a template provided by the user
- A script that runs through all test cases and checks if the program has the correct output
The repository currently only supports C++ on Windows.
First, ensure that you have git
and npm
installed.
Then, run the following commands:
git clone https://github.com/truered8/codeforces-generator
cd codeforces-generator
npm install
- Edit the required settings in
config.json
:PROBLEM_DIR
: The path where every problem directory will be savedTEMPLATE_PATH
: The path to the master template fileSOLUTION_NAME
: The name of the template file created in each problem directorySAMPLE_DIR_NAME
: The name of the test sample directory
- Run the following command:
where {problem codes} should be replaced with the code of each problem you wish to scrape. For example:
node generate {problem codes}
will generate the directories for problems 158A and 4A.node generate 158A 4A
This should be performed after you have implemented your solution.
- Enter the directory that contains the problem:
where {PROBLEM_DIR} should be replaced with the PROBLEM_DIR setting previously configured and {code of problem} should be replaced with the code of the problem.
cd {PROBLEM_DIR}\{code of problem}
- Run the batch file:
This will run each of the test cases, and output any errors your solution made.
runtests_windows.bat