diff --git a/packages/hydrojudge/src/checkers.ts b/packages/hydrojudge/src/checkers.ts index cc29adde9..a255c862f 100644 --- a/packages/hydrojudge/src/checkers.ts +++ b/packages/hydrojudge/src/checkers.ts @@ -10,6 +10,7 @@ export interface CheckConfig { output: CopyInFile; user_stdout: CopyInFile; user_stderr: CopyInFile; + code: CopyInFile; copyIn: Record; score: number; detail: boolean; @@ -176,7 +177,7 @@ const checkers: Record = new Proxy({ * input:输入 * user_out:选手输出 * answer:标准输出 - * code:选手代码 (not impl) + * code:选手代码 * stdout:输出最终得分 * stderr:输出错误报告 */ @@ -187,7 +188,7 @@ const checkers: Record = new Proxy({ input: config.input, user_out: config.user_stdout, answer: config.output, - code: { content: '' }, + code: config.code, ...config.copyIn, }, }); @@ -203,6 +204,7 @@ const checkers: Record = new Proxy({ in: config.input, user_out: config.user_stdout, answer: config.output, + user_code: config.code, ...config.copyIn, }, env: config.env, diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index 7441d57f6..cbb69f8f8 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -38,6 +38,7 @@ function judgeCase(c: NormalizedCase) { ({ status, score, message } = await checkers[ctx.config.checker_type]({ execute: ctx.checker.execute, copyIn: ctx.checker.copyIn || {}, + code: ctx.code, input: { src: c.input }, output: { src: c.output }, user_stdout: fileIds.stdout ? { fileId: fileIds.stdout } : { content: '' }, diff --git a/packages/hydrojudge/src/judge/hack.ts b/packages/hydrojudge/src/judge/hack.ts index 46cc63945..458872e70 100644 --- a/packages/hydrojudge/src/judge/hack.ts +++ b/packages/hydrojudge/src/judge/hack.ts @@ -62,6 +62,7 @@ export async function judge(ctx: Context) { output: { content: '' }, user_stdout: res.fileIds.stdout ? { fileId: res.fileIds.stdout } : { content: '' }, user_stderr: { fileId: res.fileIds.stderr }, + code: ctx.code, score: 100, detail: ctx.config.detail ?? true, env: { ...ctx.env, HYDRO_TESTCASE: '0' }, diff --git a/packages/hydrojudge/src/judge/submit_answer.ts b/packages/hydrojudge/src/judge/submit_answer.ts index 7690b7b85..8c6408c5c 100644 --- a/packages/hydrojudge/src/judge/submit_answer.ts +++ b/packages/hydrojudge/src/judge/submit_answer.ts @@ -46,6 +46,7 @@ function judgeCase(c: NormalizedCase) { output: { src: c.output }, user_stdout: file, user_stderr: { content: '' }, + code: ctx.code, score: c.score, detail: ctx.config.detail ?? true, env: { ...ctx.env, HYDRO_TESTCASE: c.id.toString() },