Managing Problems
LCOJ provides a web interface for creating and editing problems, including both problem statements and test data.
Configuration
With Docker (recommended)
Test data is stored in the dmoj/problems/ directory, which is mounted into the container automatically.
No extra configuration is needed; this is already set up in Docker.
With bare metal
In local_settings.py, set DMOJ_PROBLEM_DATA_ROOT:
DMOJ_PROBLEM_DATA_ROOT = '/home/lcoj/problems'Adding a New Problem
Step 1: Open the admin site
Go to /admin/ and log in with an admin account.
Step 2: Create the problem
Click the Add button in the Problems section.

Step 3: Fill in the basic information
Required fields:
- Problem code: The problem code (must be unique, e.g.
APLUSB) - Title: The problem name (e.g. "Sum of Two Numbers")
- Authors: Important! You must add yourself as an author, otherwise you will not be able to edit the problem

Step 4: Write the problem statement
LCOJ supports Markdown with extended features:
- LaTeX for math formulas
- Syntax highlighting for code
- Images and tables
Example problem statement:
# Problem
Given two integers $a$ and $b$, compute their sum.
## Input
A single line containing two integers $a$ and $b$ ($-10^9 \le a, b \le 10^9$).
## Output
Print a single integer, $a + b$.
## Example
### Input
```
3 5
```
### Output
```
8
```
## Limits
- Time: 1 second
- Memory: 256 MBSee the full template.
Step 5: Configure the problem
Key options:
- Time limit: Time limit (seconds)
- Memory limit: Memory limit (KB)
- Points: Points for the problem (usually 100)
- Partial: Allow partial points
- Group: Problem group
- Types: Problem types (DP, Graph, Math, ...)
- Allowed languages: Allowed languages
Step 6: Save and view
Click Save, then click View on site to view the problem.

Managing Test Data
Step 1: Open the test data editor
On the problem page, click Edit test data.

Step 2: Upload test data
Prepare a zip file containing the test data. Naming convention:
<problem_code>.<test_number>.in # Input file
<problem_code>.<test_number>.out # Output fileExample: For problem APLUSB:
APLUSB.1.in
APLUSB.1.out
APLUSB.2.in
APLUSB.2.out
APLUSB.3.in
APLUSB.3.outUpload the zip file.

Step 3: Configure test cases
Key fields:
- Input file: Path to the input file inside the zip
- Output file: Path to the output file inside the zip
- Points: Points for the test case
Example configuration:
Test 1: APLUSB.1.in, APLUSB.1.out, 30 points
Test 2: APLUSB.2.in, APLUSB.2.out, 30 points
Test 3: APLUSB.3.in, APLUSB.3.out, 40 pointsScoring
If Partial points is enabled:
Formula:
Score = (Points of passed tests / Points of all tests) × Problem pointsExample:
- The problem is worth 100 points
- 3 tests: 1/2/7 points
- A contestant passes tests 1 and 2 and fails test 3
- Score = (1+2)/(1+2+7) × 100 = 30 points
Batched Test Cases
Use these for problems with subtasks. All tests in a subtask must pass to earn its points.
How to create:
- Click Add batch
- Set the points for the batch
- Add test cases to the batch
Example:
Batch 1 (30 points):
- Test 1.1
- Test 1.2
Batch 2 (70 points):
- Test 2.1
- Test 2.2
- Test 2.3Custom Checkers
If a problem has multiple correct answers, use a custom checker.
Built-in checkers:
standard: Exact comparison (default)floats: Allows floating-point errorsorted: Ignores orderidentical: Character-by-character comparison
Choosing a checker:
In the Checker section, select the appropriate checker and configure its parameters.
Generator
If there are many tests, you can use a generator instead of uploading files.
How to use:
- Upload the generator file (C/C++)
- Configure the parameters for each test
- The system generates the input/output automatically
See also: Generator
Test Submission
Once the test data is ready, go back to the problem page and click Submit solution to try a submission.
Updating Test Data
To modify test data:
- Open Edit test data
- Upload a new zip file or edit the configuration
- Click Save
- The test data is updated automatically
Rejudge
After changing test data, you should rejudge existing submissions:
- Go to the problem page
- Click Rejudge all submissions
- Choose the rejudge scope (all submissions, or from a certain point in time)
Tips
- Name tests clearly: Easier to manage and debug
- Test thoroughly: Include edge cases and corner cases
- Check the outputs: Make sure the expected outputs are correct
- Try multiple languages: Test with C++, Python, and Java
- Read the logs carefully: If something fails, check the logs for the cause
Troubleshooting
Test data does not load:
- Check the file paths inside the zip
- Check the permissions of the
DMOJ_PROBLEM_DATA_ROOTdirectory
Checker does not work:
- Check the checker syntax
- Check the error log in the admin
Rejudge does not run:
- Check that Celery is running (Docker):
docker compose ps celery - View Celery logs (Docker):
docker compose logs -f celery - Check Celery (bare metal):
supervisorctl status celery - View Celery logs (bare metal):
supervisorctl tail -f celery
