mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
judge: update subtask parser
This commit is contained in:
1 parent
0986277b4d
commit
c5f20af2f1
2 files changed
+7
-11
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.11.7",
|
"version": "2.11.8",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ const RE0: Re0[] = [
|
|||||||
];
|
];
|
||||||
const RE1: Re1[] = [
|
const RE1: Re1[] = [
|
||||||
{
|
{
|
||||||
reg: /^([^\d]*)([0-9]+)-([0-9]+).in$/,
|
reg: /^([^\d]*)([0-9]+)([-_])([0-9]+).in$/,
|
||||||
output: [(a) => `${a[1] + a[2]}-${a[3]}.out`],
|
output: [(a) => `${a[1] + a[2]}${a[3]}${a[4]}.out`],
|
||||||
subtask: (a) => +a[2],
|
subtask: (a) => +a[2],
|
||||||
id: (a) => +a[3],
|
id: (a) => +a[4],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -218,13 +218,9 @@ export default async function readCases(folder: string, cfg: Record<string, any>
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw changeErrorType(e, FormatError);
|
throw changeErrorType(e, FormatError);
|
||||||
}
|
}
|
||||||
let auto = !result.outputs?.length;
|
let cases = result.outputs?.length || 0;
|
||||||
if (auto) {
|
cases += Math.sum((result.subtasks || []).map((subtask) => subtask.cases.length));
|
||||||
if (result.subtasks.length && Math.sum(result.subtasks.map((subtask) => subtask.cases.length))) {
|
if (!cases) {
|
||||||
auto = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (auto) {
|
|
||||||
const c = await readAutoCases(folder, args, config, result);
|
const c = await readAutoCases(folder, args, config, result);
|
||||||
result.subtasks = c.subtasks;
|
result.subtasks = c.subtasks;
|
||||||
result.count = c.count;
|
result.count = c.count;
|
||||||
|
|||||||
Reference in new issue
Block a user