judge: fix syzoj scoring

This commit is contained in:
undefined committed 2021-03-07 21:54:22 +08:00
1 parent 0babd5b821
commit a22400d247
4 files changed
+8 -7

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.4.9",
"version": "2.4.10",
"os": [
"linux"
],
+1 -1
View File
@@ -226,7 +226,7 @@ export async function readYamlCases(folder: string, cfg: Dictionary<any> = {}, a
}
if (cfg.cases) {
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'),
memory_limit_mb: parseMemoryMB(cfg.memory || '512m'),
cases: [],
+3 -3
View File
@@ -171,9 +171,9 @@ const checkers: Record<string, Checker> = {
},
});
if (status !== STATUS.STATUS_ACCEPTED) throw new SystemError('Checker returned {0}.', [status]);
const score = parseInt(stdout, 10);
status = score === config.score ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_WRONG_ANSWER;
return { status, score, message: stderr };
const score = +stdout;
status = score === 100 ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_WRONG_ANSWER;
return { status, score: Math.floor((score * config.score) / 100), message: stderr };
},
async testlib(config) {
+3 -2
View File
@@ -12,7 +12,7 @@ import * as tmpfs from './tmpfs';
import { FormatError, CompileError, SystemError } from './error';
import { STATUS_COMPILE_ERROR, STATUS_SYSTEM_ERROR } from './status';
import { compilerText } from './utils';
import readYamlCases from './cases';
import readCases from './cases';
import { getConfig } from './config';
declare module 'hydrooj/dist/interface' {
@@ -221,11 +221,12 @@ async function postInit() {
this.stat.cache_start = new Date();
this.folder = await cacheOpen(this.domainId, this.pid, this.data);
this.stat.read_cases = new Date();
this.config = await readYamlCases(
this.config = await readCases(
this.folder,
this.config,
{ next: this.next },
);
console.log(this.config);
this.stat.judge = new Date();
await judge[this.config.type || 'default'].judge(this);
}