Skip to content

truered8/codeforces-generator

Repository files navigation

codeforces-generator

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.

Getting Started

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

Usage

Creating the Problem Directory

  1. Edit the required settings in config.json:
    • PROBLEM_DIR: The path where every problem directory will be saved
    • TEMPLATE_PATH: The path to the master template file
    • SOLUTION_NAME: The name of the template file created in each problem directory
    • SAMPLE_DIR_NAME: The name of the test sample directory
  2. Run the following command:
    node generate {problem codes}
    where {problem codes} should be replaced with the code of each problem you wish to scrape. For example:
    node generate 158A 4A
    will generate the directories for problems 158A and 4A.

Running Tests

This should be performed after you have implemented your solution.

  1. Enter the directory that contains the problem:
    cd {PROBLEM_DIR}\{code of 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.
  2. Run the batch file:
    runtests_windows.bat
    This will run each of the test cases, and output any errors your solution made.

About

A tool to generate a problem directory for CodeForces problems.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •