mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
utils: fix normalizeSubtasks score (#356)
This commit is contained in:
1 parent
a585c13a72
commit
842322d15c
5 files changed
+7
-7
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.20.0",
|
"version": "2.20.1",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.13.5",
|
"version": "3.13.6",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.37.2",
|
"version": "4.37.3",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -284,25 +284,25 @@ export function normalizeSubtasks(
|
|||||||
return subtasks.map((s) => {
|
return subtasks.map((s) => {
|
||||||
id++;
|
id++;
|
||||||
s.cases.sort((a, b) => (a.id - b.id));
|
s.cases.sort((a, b) => (a.id - b.id));
|
||||||
const score = subtaskScore.next().value as number;
|
const score = s.score || subtaskScore.next().value as number;
|
||||||
const caseScore = getScore(
|
const caseScore = getScore(
|
||||||
Math.max(score - Math.sum(s.cases.map((i) => i.score || 0)), 0),
|
Math.max(score - Math.sum(s.cases.map((i) => i.score || 0)), 0),
|
||||||
s.cases.filter((i) => !i.score).length,
|
s.cases.filter((i) => !i.score).length,
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
score,
|
|
||||||
type: 'min',
|
type: 'min',
|
||||||
if: [],
|
if: [],
|
||||||
...s,
|
...s,
|
||||||
|
score,
|
||||||
time: parseTimeMS(s.time || time, !ignoreParseError),
|
time: parseTimeMS(s.time || time, !ignoreParseError),
|
||||||
memory: parseMemoryMB(s.memory || memory, !ignoreParseError),
|
memory: parseMemoryMB(s.memory || memory, !ignoreParseError),
|
||||||
cases: s.cases.map((c) => {
|
cases: s.cases.map((c) => {
|
||||||
count++;
|
count++;
|
||||||
return {
|
return {
|
||||||
id: count,
|
id: count,
|
||||||
score: s.type === 'sum' ? caseScore.next().value as number : score,
|
|
||||||
...c,
|
...c,
|
||||||
|
score: c.score || (s.type === 'sum' ? caseScore.next().value as number : score),
|
||||||
time: parseTimeMS(c.time || s.time || time, !ignoreParseError),
|
time: parseTimeMS(c.time || s.time || time, !ignoreParseError),
|
||||||
memory: parseMemoryMB(c.memory || s.memory || memory, !ignoreParseError),
|
memory: parseMemoryMB(c.memory || s.memory || memory, !ignoreParseError),
|
||||||
input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : '/dev/null',
|
input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : '/dev/null',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/utils",
|
"name": "@hydrooj/utils",
|
||||||
"version": "1.2.4",
|
"version": "1.2.5",
|
||||||
"description": "hydrooj utils",
|
"description": "hydrooj utils",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
Reference in new issue
Block a user