🚲Submissions
API Methods at /submissions route
Under construction.
Sumbit solution
POST https://api.sort-me.org/submit
Submit solution to judging.
This method has low, context-adaptive rate limit, so it can't be described with some specific constants. If you encounter 429 (Too Many Requests) HTTP error, just retry after 30-60 secs.
Request Body
problem_id*
int
ID of the task you trying to submit
environment*
string
Language code you are trying to submit
files*
[]file
Source code of your solution
contest_id
int
If you are submitting solution during contest, you need to specify its ID.
{
id: 1337 // id of your new submission
}{
"error": "no such problem or rights to view it"
}{
"error": "you are not participant of this contest or is does not exist"
}{
"error": "submission is too big",
}Get default environments
GET https://api.sort-me.org/submissions/getAvailableLanguages
On Sort Me, environment is similar to language/compiler on other platforms - for example, GNU C++ 20 or Python 3.11.
With this method, you get default environments, with which you can submit most of publically available problems.
[
{
"id": 1,
"name": "Python 3.11",
: "python",
"additional_files": true
"files": {
{
"name": "solution.py",
"type": "text",
"placeholder": "a, b = map(int, input().split())"
},
},
},
{
"name": "PyPy 3.9",
"highlight": "python",
"api": "pypy",
"ext": "py"
},
{
"name": "GNU C++20",
"highlight": "cpp",
"api": "c++",
"ext": "cpp:cc:C"
}
]Get submissions
GET https://api.sort-me.org/submissions/get
This is universal method for receiving submissions of certain user, problem, contest, or from any intersection of this parameters.
However, submissions on Sort Me are not public, so access to submissions is a bit tricky. In general, you can get response, if you are trying to get:
– Your own submissions; – Submissions sent during contest where you are admin; – Submissions which solves problem you are admin of.
Query Parameters
user_id
int
ID of user whose submissions you want to get.
If specified, it must be your ID or ID of participant of contest from contest_id parameter.
If not specified, get submissions of all users. You must be admin of contest from contest_id to do this.
problem_id
int
ID of the task you want to get submissions for.
If specified, at least one rule must be satisfied: – You are admin of the task
– You are requesting your own submissions
– You are admin of the contest from contest_id parameter, and that contest contains this task.
If not specified, get submissions for all tasks.
contest_id
int
ID of contest, submissions of which you want to get.
If specified, you must be either admin of the contest or requesting only your own submissions (by providing your ID in user_id parameter)
If not specified, get submissions sent not during contests.
offset
int
Pagination parameter.
Use id field.
{
"count": 19,
"submissions": [
{
"id": 53459, // Unique ID of submission
"user": {
"id": 578,
"handle": "imachug",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289g",
},
"task_id": 2025,
"contest_id": 35,
"worst_metrics": {
"time": 961, // Millisecconds
"memory": 253, // Megabytes
},
"submitted_at": 1665081384, // Unixtime
"environment": {
"name": "GNU C++20",
},
"verdict": 1,
"verdict_text": "Full solution",
"total_points": 100
}
]
}Get submission by ID
GET https://api.sort-me.org/submissions/getByID
Query Parameters
id*
int
ID of target submission.
Verdicts are set per problem, per subtask and per test. Here are all the types:
0- Judging. Solution is still judging.1- Full solution (for problem and subtasks) or OK (for test).2- Wrong Answer3- Time limit exceeded4- Runtime Error5- Compilation Error6- Compilation Time Limit Exceeded7- Memory Limit Exceeded8- Wrong Output Format9- Checker Error11- Judging Error12- Malicious Code13- Skipped20- Partial Solution
{
"id": 193478,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"environment": {
"id": 1,
"name": "Python 3.11",
"highlight": "python"
},
"files": [
{
"name": "solution.py",
"type": "text",
"content": "a, b = map(int, input().split())\nprint(a + b)"
}
],
"submitted_at": 1633036128,
"results": {
"points": 100,
"verdict": 1,
"verdict_text": "Accepted",
"worst_metrics": {
"time": 10,
"memory": 91
},
"subtasks": [
{
"points": 100,
"worst_metrics": {
"time": 10,
"memory": 91
},
"tests": [
{
"n": 1,
"verdict": 1,
"verdict_text": "OK",
"worst_metrics": {
"time": 9,
"memory": 87
}
},
{
"n": 2,
"verdict": 1,
"verdict_text": "OK",
"worst_metrics": {
"time": 9,
"memory": 91
}
},
{
"n": 3,
"verdict": 1,
"verdict_text": "OK",
"worst_metrics": {
"time": 10,
"memory": 81
}
}
]
}
]
}
}{
"id": 193478,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"environment": {
"id": 1,
"name": "Python 3.11",
"highlight": "python",
},
"files": [
{
"name": "solution.py",
"type": "text",
"content": "a, b = map(int, input().split())\nprint(a + b)"
}
]
"submitted_at": 1633036128,
"results": {
"points": 100,
"verdict": 1,
"verdict_text": "Accepted",
"worst_metrics": {
"time": 25,
"memory": 158
},
"subtasks": [
{
"points": 50,
"worst_metrics": {
"time": 25,
"memory": 121
}
},
{
"points": 50,
"worst_metrics": {
"time": 19,
"memory": 158
}
}
]
}
}{
"id": 193478,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"environment": {
"id": 1,
"name": "Python 3.11",
"highlight": "python",
},
"files": [
{
"name": "answers.zip",
"type": "binary",
"size": 32, // in bytes
: 1440,
}
]
"submitted_at": 1633036128,
"results": {
"points": 100,
"verdict": 1,
"verdict_text": "Accepted",
"worst_metrics": {
"time": 25,
"memory": 158
},
}
}{
"id": 2,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"environment": {
"id": 1,
"name": "Python 3.11",
"highlight": "python",
"ext": "py"
},
"code": "print(\"Hello world\")",
"submitted_at": 1664657437,
"results": {
"points": 0,
"verdict": 5,
"verdict_text": "Compilation error",
"compiler_log": "solution.cpp:1:6: error: expected constructor, destructor, or type conversion before '(' token\n 1 | print(\"Hello world\")\n | ^\ncompilation terminated due to -Wfatal-errors.\nExited with error status 1",
"worst_metrics": {
"time": 0,
"memory": 0
}
}
}{
"id": 8890,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"lang": {
"name": "Python 3.11",
"highlight": "python",
"api": "python",
"ext": "py"
},
"code": "c = 0\nfor r in input():\n if r == \"(\":\n c += 1\n else:\n c -= 1\n if c < 0:\n print(\"NO\")\n break\nelse:\n print(\"YES\" if c == 0 else \"NO\")",
"submitted_at": 1642874680,
"results": {
"points": 29,
"verdict": 3,
"verdict_text": "Time limit exceeded",
"worst_metrics": {
"time": 1016,
"memory": 0
},
"subtasks": [
{
"points": 29,
"worst_metrics": {
"time": 35,
"memory": 0
}
},
{
"points": 0,
"worst_metrics": {
"time": 1016,
"memory": 0
},
"failed_tests": [
{
"n": 26,
"verdict": 3,
"verdict_text": "Time limit exceeded",
"worst_metrics": {
"time": 1016,
"memory": 0
}
}
]
}
]
}
}{
"id": 4,
"user": {
"id": 1,
"handle": "sadfun",
"avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
},
"lang": {
"name": "GNU C++20",
"highlight": "c_cpp",
"api": "c++",
"ext": "cpp:cxx:cc"
},
"code": "#include <bits/stdc++.h>\r\n\r\n#include <ext/pb_ds/assoc_container.hpp>\r\n\r\n\r\n#define in(x) freopen(x, \"r\", stdin)\r\n#define out(x) freopen(x, \"w\", stdout)\r\n#define F first\r\n#define S second\r\n#define pb push_back\r\n#define sz(x) int(x.size())\r\n#define el '\\n'\r\n#define all(x) x.begin(), x.end()\r\n\r\nusing namespace std;\r\nusing namespace __gnu_pbds;\r\n\r\ntypedef long long ll;\r\ntypedef long double ld;\r\ntypedef short int si;\r\ntypedef unsigned long long ull;\r\ntypedef tree <ll, null_type, less_equal <ll> , rb_tree_tag, tree_order_statistics_node_update> ordered_set;\r\n\r\n\r\nconst int N = (int)5e5 + 50;\r\n\r\nll up[N][20];\r\nll a[N], b[N];\r\nint r[N], n, p[N];\r\n\r\nvector <pair <int, int> > t[2];\r\nvector <int> le[2], ri[2], adds[N];\r\nint root[N][2];\r\n\r\nint make(int p) {\r\n t[p].pb({0, 0});\r\n le[p].pb(0);\r\n ri[p].pb(0);\r\n return sz(t[p]) - 1;\r\n}\r\n\r\nint make(int v, int p) {\r\n t[p].pb(t[p][v]);\r\n le[p].pb(le[p][v]);\r\n ri[p].pb(ri[p][v]);\r\n return sz(t[p]) - 1;\r\n}\r\n\r\nvoid upd(int v, int l, int r, int ps, pair <int, int> val, int p) {\r\n if (l == r) {\r\n t[p][v] = max(t[p][v], val);\r\n } else {\r\n int md = (l + r) >> 1;\r\n if (ps <= md) {\r\n int to;\r\n if (!le[p][v]) {\r\n to = make(p);\r\n } else {\r\n to = make(le[p][v], p);\r\n }\r\n le[p][v] = to;\r\n upd(le[p][v], l, md, ps, val, p);\r\n } else {\r\n int to;\r\n if (!ri[p][v]) {\r\n to = make(p);\r\n } else {\r\n to = make(ri[p][v], p);\r\n }\r\n ri[p][v] = to;\r\n upd(ri[p][v], md + 1, r, ps, val, p);\r\n }\r\n t[p][v] = {0, 0};\r\n if (le[p][v]) {\r\n t[p][v] = max(t[p][v], t[p][le[p][v]]);\r\n }\r\n if (ri[p][v]) {\r\n t[p][v] = max(t[p][v], t[p][ri[p][v]]);\r\n }\r\n }\r\n}\r\n\r\npair <int, int> get(int v, int l, int r, int tl, int tr, int p) {\r\n if (l > r || tl > tr || tl > r || l > tr) {\r\n return {-1e9, 0};\r\n }\r\n if (l >= tl && r <= tr) {\r\n return t[p][v];\r\n }\r\n int md = (l + r) >> 1;\r\n pair <int, int> cur = {-(int)1e9, 0};\r\n if (le[p][v]) {\r\n cur = max(cur, get(le[p][v], l, md, tl, tr, p));\r\n }\r\n if (ri[p][v]) {\r\n cur = max(cur, get(ri[p][v], md + 1, r, tl, tr, p));\r\n }\r\n return cur;\r\n}\r\n\r\nll get(int l, int r) {\r\n int len = r - l + 1;\r\n int st = p[len];\r\n return __gcd(up[l][st], up[r - (1 << st) + 1][st]);\r\n}\r\n\r\nint main() {\r\n// freopen(\"input.txt\", \"r\", stdin);\r\n// freopen(\"output.txt\", \"w\", stdout);\r\n ios::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n ll k;\r\n cin >> n >> k;\r\n for (int i = 1; i <= n; i++) {\r\n cin >> a[i];\r\n }\r\n for (int i = 1; i < n; i++) {\r\n b[i] = abs(a[i] - a[i + 1]);\r\n }\r\n for (int i = 1; i < n; i++) {\r\n up[i][0] = b[i];\r\n }\r\n p[0] = -1;\r\n for (int i = 1; i <= n; i++) {\r\n p[i] = p[i / 2] + 1;\r\n }\r\n\r\n for (int st = 1; st <= p[n]; st++) {\r\n for (int i = 1; i < n; i++) {\r\n up[i][st] = __gcd(up[i][st - 1], up[min(n - 1, i + (1 << (st - 1)))][st - 1]);\r\n }\r\n }\r\n int ans = 0;\r\n for (int i = 1, j = 1; i < n; i++) {\r\n j = max(j, i);\r\n while (j < n && get(i, j) != 1) {\r\n j++;\r\n }\r\n r[i] = j - 1;\r\n }\r\n root[n][0] = make(0); root[n][1] = make(1);\r\n for (int i = n - 1; i >= 1; i--) {\r\n root[i][0] = make(root[i + 1][0], 0);\r\n if (r[i] >= i) {\r\n upd(root[i][0], 1, n, r[i], {r[i] - i + 2, i}, 0);\r\n adds[r[i]].pb(i);\r\n }\r\n }\r\n for (int i = n - 1; i >= 1; i--) {\r\n root[i][1] = make(root[i + 1][1], 1);\r\n for (auto l : adds[i]) {\r\n upd(root[i][1], 1, n, l, {n - l, l}, 1);\r\n }\r\n }\r\n\r\n int q, l, r;\r\n cin >> q;\r\n while (q--) {\r\n cin >> l >> r;\r\n l = (l + ans * 1ll * k - 1) % n + 1; r = (r + ans * 1ll * k - 1) % n + 1;\r\n if (l > r) {\r\n swap(l, r);\r\n }\r\n r--;\r\n if (l > r) {\r\n cout << l << \" \" << l << el;\r\n ans = 1;\r\n continue;\r\n }\r\n pair <int, int> cur1 = max(get(root[l][0], 1, n, l, r, 0), {1, l});\r\n pair <int, int> cur2 = get(root[r + 1][1], 1, n, l, r, 1);\r\n cur2.F = r - (n - cur2.F) + 2;\r\n if (cur1.F < cur2.F) {\r\n cout << cur2.S << \" \" << cur2.S + cur2.F - 1 << el;\r\n } else {\r\n cout << cur1.S << \" \" << cur1.S + cur1.F - 1 << el;\r\n }\r\n ans = max(cur1.F, cur2.F);\r\n }\r\n}\r\n",
"submitted_at": 1658142512,
"results": {
"points": 0,
"verdict": 0,
"verdict_text": "Judging",
"worst_metrics": {
"time": 0,
"memory": 0
}
}
}{
"error": "no submission with such id or you have no rights to view it"
}Last updated