GithubHelp home page GithubHelp logo

codeforcesrunner's Introduction

Installation

The library lxml is needed. Please reference here for more information.

If you are an Debian/Ubuntu user, simply type:

$ sudo apt-get install python3-lxml

Usage

Using Codeforces Problem 198A problem as an example.

Donwload Sample Tests

The url of this problem is http://codeforces.com/problemset/problem/198/A. Please notice the contest_id is 198 and the problem_id is A.

$ cf.py -c 198 -p A     # download this problem
$ cf.py -c 198          # download all problems in this contest

There is another url http://codeforces.com/contest/198/problem/A which indicated the same problem. You can see the contest_id and problem_id is same, so it wouldn't be a problem.

Running the Tests

Suppose your source code is named A.{lang}, which {lang} could be cpp, c, java or py for the current version.

Then, simple run cf.py A.{lang}, you will get the result like this:

$ cf.py A.java
output:
2
=== Case #1: AC (85 ms) ===

output:
2
answer:
3
=== Case #2: WA (83 ms) ===

press enter to continue or <C-c> to leave.
output:
Exception in thread "main" java.lang.Exception
        at A.<init>(A.java:12)
        at A.main(A.java:18)
answer:
0
=== Case #3: RE (95 ms) ===

press enter to continue or <C-c> to leave.

Configurations

The file `conf.py' contains the compile & execute commands of support languages, so you could add more commands to support more languages easily by yourself.

The section [global] in conf.py contains some setting about the test file's name. Since the source code's name and the test file's name must be exactly same, you could change these settings to follow your naming convension. For example:

In the default setting:

PATTERN = "upper({id})"
REPLACE_SPACE = "_"
EXTENSION = ".xml"

the filename would be 'A.xml'

Or you could added the contest id and problem's name: (also notice the replace_space)

PATTERN = "{contest}-upper({id})-lower({name})"
REPLACE_SPACE = "-"
EXTENSION = ".xml"

the filename would be 'A-about-bacteria.xml'

Set variable EXTRACT_INDIVIDUAL_TEST to True, if you wish store individual test cases in separate plain text files (with extension .in).

Similarly, set variable CREATE_DIRECTORY_PER_PROBLEM to True, if you want to work with a separate directory for each problem,

About

This tool is only verifiid on Linux now, but I think it could be run on other platforms, although it maybe need a little modify.

Please feel free to fork and any suggesions are welcome.

codeforcesrunner's People

Contributors

alculquicondor avatar alexeydmitriev avatar cjoa avatar mrjohannchang avatar sayuan avatar

Forkers

nperraud

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.