mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +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",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.11.7",
|
||||
"version": "2.11.8",
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -40,10 +40,10 @@ const RE0: Re0[] = [
|
||||
];
|
||||
const RE1: Re1[] = [
|
||||
{
|
||||
reg: /^([^\d]*)([0-9]+)-([0-9]+).in$/,
|
||||
output: [(a) => `${a[1] + a[2]}-${a[3]}.out`],
|
||||
reg: /^([^\d]*)([0-9]+)([-_])([0-9]+).in$/,
|
||||
output: [(a) => `${a[1] + a[2]}${a[3]}${a[4]}.out`],
|
||||
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) {
|
||||
throw changeErrorType(e, FormatError);
|
||||
}
|
||||
let auto = !result.outputs?.length;
|
||||
if (auto) {
|
||||
if (result.subtasks.length && Math.sum(result.subtasks.map((subtask) => subtask.cases.length))) {
|
||||
auto = false;
|
||||
}
|
||||
}
|
||||
if (auto) {
|
||||
let cases = result.outputs?.length || 0;
|
||||
cases += Math.sum((result.subtasks || []).map((subtask) => subtask.cases.length));
|
||||
if (!cases) {
|
||||
const c = await readAutoCases(folder, args, config, result);
|
||||
result.subtasks = c.subtasks;
|
||||
result.count = c.count;
|
||||
|
||||
Reference in new issue
Block a user