β°οΈProblems
API Methods at /problems route
Get problem by ID
GET
https://sort-me.org/api/problems/getByID
ποΈ Localization applies.
Query Parameters
id*
int
ID of the problem
{
"id": 1,
"translations": ["ru", "en", "de", "pl", "uk", "es"],
"matched_translation": "en",
"name": "A+B",
"legend": "Your mission is to add two integers $A$ and $B$.\n**Input data**.\nThe only line of input contains two space-separated integers. The values of the numbers do not exceed $10^9$.\n**Output data**.\nThe only line must contain a single integer - the sum of the numbers $A$ and $B$.\n**Scoring**.\nYour solution will run on two subtasks.\nIn the first subtask, you will only receive points for passing all the tests.\nThe second subtask has 10 tests, for each of which your solution will receive 5 points.",
"limits": {
"time": 1000,
"memory": 262144
},
"samples": [
{
"stdin": "2 3",
"stdout": "5"
},
{
"stdin": "8 1",
"stdout": "9"
}
],
"subtasks": [
{
"points": 50,
"description": "$A, B \\le 1000$",
"test_count": 0
},
{
"points": 50,
"depends": [
1
],
"description": "$A, B \\le 10^9$",
"test_count": 0
}
],
"environments": [
{
"id": 1,
"name": "Python 3.11",
"files": [
{"name": "solution.py", "type": "text"}
]
},
{
"id": 2,
"name": "GNU C++20",
"additional_files": true,
"files": [
{"name": "solution.cpp", "type": "text"}
]
}
]
}
Get public problems
GET
https://sort-me.org/api/problems/getPublic
Returns all the public problems available at Sort Me problems page.
{
"problems": [
{
"id": 1,
"names": {
"en": "A+B",
"fr": "A+B",
"ru": "A+B"
},
"marker": "solved",
"difficulty": 2,
"solved_by": 0,
"tags": [1]
}
// other problems
]
}
Get tags
GET
https://sort-me.org/api/problems/getTags
Returns all the tags which can be assigned to problems, and count of public problems which has the tags.
Managing problems
Get managed problems
GET
https://sort-me.org/api/problems/getManaged
Returns all the problems where you are an admin of any level. The same list at Sort Me problems page under "Managed" tab.
{
"remaining_quota": 9,
"problems": [
{
"id": 1,
"names": {
"en": "A+B"
},
"marker": "verified",
"creator": {
"id": 1,
"handle": "sadfun",
"name": "Π‘ΡΠ΅ΠΏΠ°Π½",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"tags": [1, 7],
"included_in_contests": 412
}
]
}
Create a new problem
POST
https://sort-me.org/api/problems/create
Create a new problem from scratch.
Request Body
initial_translation
string
If passed, problem will init with this language as first translation.
{
"status": "ok",
"id": 2,
}
Import problem
POST
https://sort-me.org/api/problems/import
Import problem from another platform.
You must include ZIP archive with your problem in form-data document
field.
Query Parameters
source*
string
From where you are import problem.
For now, the only supported value is polygon
- for imports from Polygon or Codeforces.
{"id": 100}
Set statement
POST
https://sort-me.org/api/problems/setStatement
Set problem statement for specific language/translation.
Request Body
id*
int
Problem ID
translation*
string
Language code of the translation
statement*
string
Actual statement
{
"status": "ok"
}
Drop statement
POST
https://sort-me.org/api/problems/dropStatement
Drop problem statement for specific language/translation.
Request Body
id*
int
Problem ID
translation*
string
Language code of the translation
{
"status": "ok"
}
Set subtasks
POST
https://sort-me.org/api/problems/setSubtasks
Set subtasks for a problem.
Some problems on Sort Me are visually divided into subtasks, while others are not. However, internally, every problem on Sort Me is split into subtasks. If a problem isn't visually divided, it's because it's actually has just one subtask.
So, if you pass an empty list, problem will still preserve one subtask.
Request Body
id*
int
Problem ID
{
"status": "ok"
}
Working with admins
Get admins
GET
https://sort-me.org/api/problems/getAdmins
Get all admins of specific problems. Available only if you are admin of the problem.
Request Body
id*
int
Problem ID
{
"status": "ok"
}
Set admin
POST
https://sort-me.org/api/problems/setAdmin
Get all admins of specific problems. Available only if you are admin of the problem.
Request Body
id*
int
Problem ID
Admin levels are interpreted as integers:
5 - Creator 4 - Administrator 3 - Editor 2 - Just look
{
"admins": [
{
"user": {
"id": 1,
"handle": "sadfun",
"name": "Π‘ΡΠ΅ΠΏΠ°Π½",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"level": 5
},
{
"user": {
"id": 2,
"handle": "goosescout",
"name": "ΠΠ΅ΠΉΠ½Π΅Ρ ΠΡΠΊΠΈ",
"avatar": "https://pic.sort-me.org/b2e242fd-22e3-474a-977d-e7e8fe899470"
},
"level": 4
},
{
"user": {
"id": 3,
"handle": "skycoder",
"name": "ΠΠΈΡ
Π°ΠΈΠ» ΠΠΈΡΠ΅Π΅Π²",
"avatar": "https://t.me/i/userpic/320/ZwLhJ_lLiq977R4qO2Nha738PREo-phOJoQIcIosmVY.jpg"
},
"level": 3
}
]
}
Working with tests
Get tests
GET
https://sort-me.org/api/problems/getTests
Get tests of the problem. Returns both tests and their subtasks.
Query Parameters
problem_id
int
ID of the problem
{
"subtasks": [
{
"points": 100,
"description": {"en": "-"},
"test_count": 2,
"scoring": {
"reward_each_test": true,
"test_rewards": [45, 55],
"stop_on_error": false
},
}
],
"tests": [
{
"stdin_preview": "3\n3 2 1",
"stdout_preview": "YES\n1\n3 1",
"stdin_size": 7,
"stdout_size": 9,
"reference": {
"stdin_sha256": "466c7ba46618652fc40c184dd2ce7191e0ead2926f9026d8a763eeab57134dfe",
"stdout_sha256": "407ad1ab7317efd0a92d415df5291de5ad8de4013e93328a395c79ecd82bf65d"
},
"comment": "sample #1"
},
{
"stdin_preview": "6\n2 5 5 2 10 9",
"stdout_preview": "YES\n2\n4 2\n6 5",
"stdin_size": 14,
"stdout_size": 13,
"reference": {
"stdin_sha256": "9e55c70b59effbe14d79d83bf339960c814c848caf58d31d7a373c173b775291",
"stdout_sha256": "1a00ab18c0310d17edc497d70f0a4af3457c4a365850e2f50a694188a0c82f29"
},
"comment": "sample #2"
},
]
}
Get specific test
GET
https://sort-me.org/api/problems/getTest
Get specific test of the problem. Be careful, sometimes tests can be very large (around tens of MBs).
Query Parameters
problem_id*
int
ID of the problem
{
"stdin_preview": "6\n2 5 5 2 10 9",
"stdout_preview": "YES\n2\n4 2\n6 5",
"stdin_size": 14,
"stdout_size": 13,
"reference": {
"stdin_sha256": "9e55c70b59effbe14d79d83bf339960c814c848caf58d31d7a373c173b775291",
"stdout_sha256": "1a00ab18c0310d17edc497d70f0a4af3457c4a365850e2f50a694188a0c82f29"
},
"comment": "",
"stdin": "6\n2 5 5 2 10 9",
"stdout": "YES\n2\n4 2\n6 5",
"subtask": 1
}
Set specific test
POST
https://sort-me.org/api/problems/setTest
Set specific test for the problem.
Request Body
problem_id*
int
ID of the problem
test_id
int
Test number to insert, counted from 1.
If presented, the test will replace existing test with test_id number. If not, adds new test.
stdin*
string
Content of the test stdin
stdout*
string
Content of the test stdout
{
"status": "ok"
}
Set samples count
POST
https://sort-me.org/api/problems/setSamplesCount
Set count of the sampled - subslice of tests available within task's public page. By the design of Sort Me, there is no way to set samples separate from the actual tests.
Request Body
problem_id*
int
ID of the problem
samples_count*
int
Count of the samples
{
"status": "ok"
}
Reorder tests
POST
https://sort-me.org/api/problems/reorderTests
This method can help you to efficiently change the order of tests, without downloading or re-uploading it.
Request Body
problem_id*
int
ID of the problem
new_order
[]int
IDs of the tests. Must be valid permutation from 1 to N, where N is tests count.
{
"status": "ok"
}
Drop test
POST
https://sort-me.org/api/problems/dropTest
Delete test from problem.
Request Body
problem_id*
int
ID of the problem
test_id*
int
ID of the test
{
"status": "ok"
}
Set test comment
POST
https://sort-me.org/api/problems/setTestComment
Set comment for specific test.
Request Body
problem_id*
int
ID of the problem
test_id*
int
ID of the test
comment*
string
New comment for the test
{
"status": "ok"
}
Import tests
POST
https://sort-me.org/api/problems/importTests
Upload ZIP archive with tests, previously downloaded from Sort Me or exported from another platform.
For now, import handler supports two formats:
01, 01.a, 02, 02.a...
input001.txt, output001.txt, input002.txt, output002.txt...
You must include your ZIP archive in form-data document
field.
Query Parameters
problem_id*
int
ID of the problem
erase_existing
bool
For future use. Just set it to true
and remember that, after importing, all old tests will be erased.
{
"status": "ok"
}
Export tests
GET
https://sort-me.org/api/problems/exportTests
Download ZIP archive with tests of the problem.
Exported tests have such format: input001.txt, output001.txt, input002.txt, output002.txt...
.
Query Parameters
problem_id*
int
ID of the problem
Last updated