diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 5654158f0..c3a5cc739 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.8.14", + "version": "2.8.15", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/judge/interactive.ts b/packages/hydrojudge/src/judge/interactive.ts index 1ee7402ba..b897fd3a3 100644 --- a/packages/hydrojudge/src/judge/interactive.ts +++ b/packages/hydrojudge/src/judge/interactive.ts @@ -50,7 +50,7 @@ function judgeCase(c) { status = result.status; score = result.score; message = result.message; - if (resInteractor.code && resInteractor.code !== 1) message += ` (Interactor exited with code ${resInteractor.code})`; + if (resInteractor.code && !(resInteractor.stderr || '').trim().length) message += ` (Interactor exited with code ${resInteractor.code})`; } ctxSubtask.score = Score[ctxSubtask.subtask.type](ctxSubtask.score, score); ctxSubtask.status = Math.max(ctxSubtask.status, status); diff --git a/packages/hydrojudge/src/testlib.ts b/packages/hydrojudge/src/testlib.ts index 271c2da98..a3494e623 100644 --- a/packages/hydrojudge/src/testlib.ts +++ b/packages/hydrojudge/src/testlib.ts @@ -3,7 +3,7 @@ import * as STATUS from './status'; export function parse(output: string, fullscore: number) { let status = STATUS.STATUS_WRONG_ANSWER; let score = 0; - let message = ''; + let message = output; if (output.startsWith('ok ')) { status = STATUS.STATUS_ACCEPTED; score = fullscore; @@ -11,14 +11,22 @@ export function parse(output: string, fullscore: number) { message = output.split('wrong answer ')[1] || ''; } else if (output.startsWith('wrong output format ')) { message = `PE ${output.split('wrong output format ')[1] || ''}`; - } else if (output.startsWith('unexpected eof ')) { - message = `UE ${output.split('unexpected eof ')[1] || ''}`; } else if (output.startsWith('partially correct ')) { message = `PC ${output.split('partially correct ')[1] || ''}`; const p = +output.split('partially correct (')[1].split(')')[0]; score = Math.floor(fullscore * (p / 200)); + } else if (output.startsWith('points ')) { + const p = +output.split('points ')[1].split(' ')[0]; + if (p === 100) { + status = STATUS.STATUS_ACCEPTED; + score = fullscore; + const base = output.split('points ')[1] || ''; + message = base.substr(base.indexOf(' '), 1024); + } else { + message = `partially correct ${output.split('points ')[1] || ''}`; + score = Math.floor(fullscore * (p / 100)); + } } else if (output.startsWith('FAIL ')) { - message = output.split('FAIL ')[1] || ''; status = STATUS.STATUS_SYSTEM_ERROR; } return { status, score, message };