mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix syzoj scoring
This commit is contained in:
1 parent
0babd5b821
commit
a22400d247
4 files changed
+8
-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.4.9",
|
"version": "2.4.10",
|
||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ export async function readYamlCases(folder: string, cfg: Dictionary<any> = {}, a
|
|||||||
}
|
}
|
||||||
if (cfg.cases) {
|
if (cfg.cases) {
|
||||||
config.subtasks = [{
|
config.subtasks = [{
|
||||||
score: parseInt(cfg.score, 10) || Math.floor(100 / config.count),
|
score: parseInt(cfg.score, 10) || Math.floor(100 / cfg.cases.length),
|
||||||
time_limit_ms: parseTimeMS(cfg.time || '1s'),
|
time_limit_ms: parseTimeMS(cfg.time || '1s'),
|
||||||
memory_limit_mb: parseMemoryMB(cfg.memory || '512m'),
|
memory_limit_mb: parseMemoryMB(cfg.memory || '512m'),
|
||||||
cases: [],
|
cases: [],
|
||||||
|
|||||||
@@ -171,9 +171,9 @@ const checkers: Record<string, Checker> = {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (status !== STATUS.STATUS_ACCEPTED) throw new SystemError('Checker returned {0}.', [status]);
|
if (status !== STATUS.STATUS_ACCEPTED) throw new SystemError('Checker returned {0}.', [status]);
|
||||||
const score = parseInt(stdout, 10);
|
const score = +stdout;
|
||||||
status = score === config.score ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_WRONG_ANSWER;
|
status = score === 100 ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_WRONG_ANSWER;
|
||||||
return { status, score, message: stderr };
|
return { status, score: Math.floor((score * config.score) / 100), message: stderr };
|
||||||
},
|
},
|
||||||
|
|
||||||
async testlib(config) {
|
async testlib(config) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import * as tmpfs from './tmpfs';
|
|||||||
import { FormatError, CompileError, SystemError } from './error';
|
import { FormatError, CompileError, SystemError } from './error';
|
||||||
import { STATUS_COMPILE_ERROR, STATUS_SYSTEM_ERROR } from './status';
|
import { STATUS_COMPILE_ERROR, STATUS_SYSTEM_ERROR } from './status';
|
||||||
import { compilerText } from './utils';
|
import { compilerText } from './utils';
|
||||||
import readYamlCases from './cases';
|
import readCases from './cases';
|
||||||
import { getConfig } from './config';
|
import { getConfig } from './config';
|
||||||
|
|
||||||
declare module 'hydrooj/dist/interface' {
|
declare module 'hydrooj/dist/interface' {
|
||||||
@@ -221,11 +221,12 @@ async function postInit() {
|
|||||||
this.stat.cache_start = new Date();
|
this.stat.cache_start = new Date();
|
||||||
this.folder = await cacheOpen(this.domainId, this.pid, this.data);
|
this.folder = await cacheOpen(this.domainId, this.pid, this.data);
|
||||||
this.stat.read_cases = new Date();
|
this.stat.read_cases = new Date();
|
||||||
this.config = await readYamlCases(
|
this.config = await readCases(
|
||||||
this.folder,
|
this.folder,
|
||||||
this.config,
|
this.config,
|
||||||
{ next: this.next },
|
{ next: this.next },
|
||||||
);
|
);
|
||||||
|
console.log(this.config);
|
||||||
this.stat.judge = new Date();
|
this.stat.judge = new Date();
|
||||||
await judge[this.config.type || 'default'].judge(this);
|
await judge[this.config.type || 'default'].judge(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user