mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
judge: fix readCases with limits
This commit is contained in:
1 parent
bee8537a91
commit
04a68e35bd
4 files changed
+17
-17
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.5.3",
|
"version": "2.5.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ interface Re1 extends Re0 {
|
|||||||
|
|
||||||
const RE0: Re0[] = [
|
const RE0: Re0[] = [
|
||||||
{
|
{
|
||||||
reg: /^([a-z+_\-A-Z]*)([0-9]+).in$/,
|
reg: /^([^\d]*)([0-9]+).in$/,
|
||||||
output: (a) => `${a[1] + a[2]}.out`,
|
output: (a) => `${a[1] + a[2]}.out`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: /^([a-z+_\-A-Z]*)([0-9]+).in$/,
|
reg: /^([^\d]*)([0-9]+).in$/,
|
||||||
output: (a) => `${a[1] + a[2]}.ans`,
|
output: (a) => `${a[1] + a[2]}.ans`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: /^([a-z+_\-A-Z0-9]*)\.in([0-9]+)$/,
|
reg: /^([^\d]*)\.in([0-9]+)$/,
|
||||||
output: (a) => `${a[1]}.ou${a[2]}`,
|
output: (a) => `${a[1]}.ou${a[2]}`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
@@ -40,17 +40,17 @@ const RE0: Re0[] = [
|
|||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: /^input\/([a-z+_\-A-Z]*)([0-9]+).in$/,
|
reg: /^input\/([^\d]*)([0-9]+).in$/,
|
||||||
output: (a) => `output/${a[1] + a[2]}.out`,
|
output: (a) => `output/${a[1] + a[2]}.out`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: /^input\/([a-z+_\-A-Z]*)([0-9]+).in$/,
|
reg: /^input\/([^\d]*)([0-9]+).in$/,
|
||||||
output: (a) => `output/${a[1] + a[2]}.ans`,
|
output: (a) => `output/${a[1] + a[2]}.ans`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
reg: /^input\/([a-z+_\-A-Z0-9]*)\.in([0-9]+)$/,
|
reg: /^input\/([^\d]*)\.in([0-9]+)$/,
|
||||||
output: (a) => `output/${a[1]}.ou${a[2]}`,
|
output: (a) => `output/${a[1]}.ou${a[2]}`,
|
||||||
id: (a) => parseInt(a[2], 10),
|
id: (a) => parseInt(a[2], 10),
|
||||||
},
|
},
|
||||||
@@ -228,9 +228,9 @@ export default async function readCases(folder: string, cfg: Record<string, any>
|
|||||||
throw changeErrorType(e, FormatError);
|
throw changeErrorType(e, FormatError);
|
||||||
}
|
}
|
||||||
if (!(result.outputs || result.subtasks.length)) {
|
if (!(result.outputs || result.subtasks.length)) {
|
||||||
const c = await readAutoCases(folder, args, cfg);
|
const c = await readAutoCases(folder, args, config);
|
||||||
config.subtasks = c.subtasks;
|
result.subtasks = c.subtasks;
|
||||||
config.count = c.count;
|
result.count = c.count;
|
||||||
}
|
}
|
||||||
isValidConfig(result);
|
isValidConfig(result);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.23.2",
|
"version": "2.23.3",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -186,6 +186,12 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
this.extraTitleContent = this.pdoc.title;
|
this.extraTitleContent = this.pdoc.title;
|
||||||
|
// Get time and memory limit
|
||||||
|
try {
|
||||||
|
this.response.body.pdoc.config = await parseConfig(this.pdoc.config);
|
||||||
|
} catch (e) {
|
||||||
|
this.response.body.pdoc.config = `Cannot parse: ${e.message}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@@ -194,12 +200,6 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
// e.g.  will navigate to 
|
// e.g.  will navigate to 
|
||||||
this.response.body.pdoc.content = this.response.body.pdoc.content
|
this.response.body.pdoc.content = this.response.body.pdoc.content
|
||||||
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`);
|
.replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`);
|
||||||
// Get time and memory limit
|
|
||||||
try {
|
|
||||||
this.response.body.pdoc.config = await parseConfig(this.pdoc.config);
|
|
||||||
} catch (e) {
|
|
||||||
this.response.body.pdoc.config = `Cannot parse: ${e.message}`;
|
|
||||||
}
|
|
||||||
if (this.pdoc.psdoc) {
|
if (this.pdoc.psdoc) {
|
||||||
this.response.body.rdoc = await record.get(this.domainId, this.pdoc.psdoc.rid);
|
this.response.body.rdoc = await record.get(this.domainId, this.pdoc.psdoc.rid);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user