Submit
cpbooster
provides the following command to automatically
submit your code to any supported Online Judge. See Supported Online Judges.
or its alias which is just s
.
#
Demo#
Requirements- Login with
cpb login <OnlineJudgeName>
- Specify URL in file or as argument.
- Configure Language Aliases for each platform and language.
note
cpbooster
uses a specific chromium binary that gets installed automatically in OS-specific cache
folders:
%USERPROFILE%\AppData\Local\ms-playwright
on Windows~/Library/Caches/ms-playwright
on MacOS~/.cache/ms-playwright
on Linux
according to playwright docs
#
LoginBefore you can use the submit
command you will need to login
to the Online Judge where you will submit your code.
For example, to login to AtCoder I would execute the following command
The name can be written in upper or lowercase or mixed, it doesn't matter.
note
The submit
command will automatically open the login page
if it detects that you are not logged in, then it will continue
to submit your code. So, the submit
command will execute at most 2
actions.
information
cpbooster
will NOT send any account information
to anyone else, all it does is, save your cookies
and session information like any browser does locally (in
$HOME/.cpbooster/cpbooster-session.json
).
#
How To Specify The URLWhen you run cpb submit
you can provide the url
in 2 different ways:
#
1. As A Command ArgumentYou can specify the url
after the <filePath>
in the submit
command.
For example:
#
2. As A Commented Line In The Source FileAnother way to specify the url
is by writing the string problem-url:
followed by
the url
as a commented line somewhere in your source file. In this way
you will be able to submit your code without adding extra argument in the
command, just like in the demo.
For example:
A.DistanceAndAxis.cpp
#
important
This line will be automatically added when you clone a contest with cpb clone
.
So, no need to do anything manually during a contest.
note
If you specify the url in both ways (argument and commented line), the one specified as argument will be used.
#
How To Configure Language AliasesThe language alias is the ID of the language for each Online Judge.
See How To Find Language IDs. For example, in Codeforces,
the alias for cpp
can be any of:
ID | Name |
---|---|
42 | GNU G++11 5.1.0 |
50 | GNU G++14 6.4.0 |
54 | GNU G++17 7.3.0 |
Let's say we want to submit our cpp
file using G++17, then
we should specify it
in languages.cpp.aliases.codeforces
like this:
#
How To Find Language IDsTo find language IDs follow the next steps:
#
1. Navigate to the online judge page where the language dropdown is locatedSome online judges use group of radio buttons or some other type of selectors for languages, like Uva Online Judge.
For example, in Codeforces and AtCoder you could go to any problem's page like:
#
2. Open the inspection toolUsually to open the inspection tool, you can right click
in the page,
and then click on Inspect
.
<select>
tag#
3. Locate the Also, note that we could also be looking for radio buttons, for example: Uva Online Judge uses Radio Buttons instead of a dropdown menu.
tip
Press ctrl+f
to open the search box, and type <select
. This will help you
to find the tag faster
value
of the language you wish to use#
4. Locate the For this, we will need to unfold the contents of the <select>
tag to see
the options. This is done by clicking on the small arrow to the left.
The content of the value
property of each option is what cpbooster
uses as Alias.
So, now you can just copy and paste the value into your configuration file.
For example, if you want to use C++ (Clang 10.0.0)
for cpp
files in AtCoder, you could write
your configuration file as follows.
#
Supported Online Judgesnote
If you wish to add support for another Online Judge you can
create a Pull Request in cpbooster
's github repository.
See Add Online Judge Support for guidance on how to do it.