mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
judge: respect hack subtask configured score
This commit is contained in:
1 parent
f87c320e42
commit
3401cd75bf
3 files changed
+9
-5
No files matched your search
@@ -89,10 +89,13 @@ export const runFlow = async (ctx: Context, task: Task) => {
|
|||||||
const runner = task.judgeCase(subtask.cases.find((i) => i.input === ctx.meta.hackRejudge));
|
const runner = task.judgeCase(subtask.cases.find((i) => i.input === ctx.meta.hackRejudge));
|
||||||
const res = await runner(ctx, ctxSubtask, runner);
|
const res = await runner(ctx, ctxSubtask, runner);
|
||||||
if (res) ctx.next({ case: res });
|
if (res) ctx.next({ case: res });
|
||||||
ctx.end({
|
const totalScore = Math.sum(ctx.config.subtasks.map((i) => i.score));
|
||||||
status: ctxSubtask.status === STATUS.STATUS_ACCEPTED ? STATUS.STATUS_ACCEPTED : STATUS.STATUS_HACKED,
|
if (ctxSubtask.status !== STATUS.STATUS_ACCEPTED) {
|
||||||
score: 97,
|
ctx.end({
|
||||||
});
|
status: STATUS.STATUS_HACKED,
|
||||||
|
score: totalScore - subtask.score,
|
||||||
|
});
|
||||||
|
} else ctx.end({ nop: true });
|
||||||
} else {
|
} else {
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid], sid, task.judgeCase)(ctx));
|
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid], sid, task.judgeCase)(ctx));
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ class JudgeConnectionHandler extends ConnectionHandler {
|
|||||||
if (msg.key !== 'ping' && msg.key !== 'prio') logger[['status', 'next'].includes(msg.key) ? 'debug' : 'info']('%o', msg);
|
if (msg.key !== 'ping' && msg.key !== 'prio') logger[['status', 'next'].includes(msg.key) ? 'debug' : 'info']('%o', msg);
|
||||||
if (msg.key === 'next') await next(msg);
|
if (msg.key === 'next') await next(msg);
|
||||||
else if (msg.key === 'end') {
|
else if (msg.key === 'end') {
|
||||||
await end({ judger: this.user._id, ...msg }).catch((e) => logger.error(e));
|
if (!msg.nop) await end({ judger: this.user._id, ...msg }).catch((e) => logger.error(e));
|
||||||
this.processing = null;
|
this.processing = null;
|
||||||
await this.newTask();
|
await this.newTask();
|
||||||
} else if (msg.key === 'status') {
|
} else if (msg.key === 'status') {
|
||||||
|
|||||||
@@ -539,6 +539,7 @@ export interface JudgeResultBody {
|
|||||||
memory?: number;
|
memory?: number;
|
||||||
message?: string | JudgeMessage;
|
message?: string | JudgeMessage;
|
||||||
compilerText?: string;
|
compilerText?: string;
|
||||||
|
nop?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Task {
|
export interface Task {
|
||||||
|
|||||||
Reference in new issue
Block a user