diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 5e722342e..5654158f0 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.13", + "version": "2.8.14", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index 9380b3d56..45fb3bca7 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -107,7 +107,6 @@ function judgeCase(c, sid) { function judgeSubtask(subtask, sid) { return async (ctx) => { - subtask.time *= ctx.time_limit_rate; subtask.type = subtask.type || 'min'; const ctxSubtask = { subtask, @@ -132,8 +131,6 @@ function judgeSubtask(subtask, sid) { export const judge = async (ctx) => { if (!ctx.config.subtasks.length) throw new SystemError('Problem data not found.'); - const info = ctx.getLang(ctx.lang); - ctx.time_limit_rate = info.time_limit_rate || 1; ctx.next({ status: STATUS.STATUS_COMPILING }); [ctx.execute, ctx.checker] = await Promise.all([ (() => { diff --git a/packages/hydrojudge/src/judge/interactive.ts b/packages/hydrojudge/src/judge/interactive.ts index 836336813..1ee7402ba 100644 --- a/packages/hydrojudge/src/judge/interactive.ts +++ b/packages/hydrojudge/src/judge/interactive.ts @@ -23,12 +23,12 @@ function judgeCase(c) { { execute: ctx.executeUser.execute.replace(/\$\{name\}/g, 'code'), copyIn: ctx.executeUser.copyIn, - time: ctxSubtask.subtask.time, + time: ctxSubtask.subtask.time * ctx.executeUser.time, memory: ctxSubtask.subtask.memory, }, { execute: `${ctx.executeInteractor.execute.replace(/\$\{name\}/g, 'interactor')} /w/in /w/tout /w/out`, copyIn: ctx.executeInteractor.copyIn, - time: ctxSubtask.subtask.time * 2, + time: ctxSubtask.subtask.time * 2 * ctx.executeInteractor.time, memory: ctxSubtask.subtask.memory * 2, copyOut: ['/w/tout?'], }, @@ -37,7 +37,7 @@ function judgeCase(c) { let status; let score = 0; let message: any = ''; - if (time_usage_ms > ctxSubtask.subtask.time) { + if (time_usage_ms > ctxSubtask.subtask.time * ctx.executeUser.time) { status = STATUS.STATUS_TIME_LIMIT_EXCEEDED; } else if (memory_usage_kb > ctxSubtask.subtask.memory * 1024) { status = STATUS.STATUS_MEMORY_LIMIT_EXCEEDED; @@ -72,7 +72,6 @@ function judgeCase(c) { function judgeSubtask(subtask) { return async (ctx) => { - subtask.time *= ctx.time_limit_rate; subtask.type = subtask.type || 'min'; const ctxSubtask = { subtask, @@ -93,7 +92,6 @@ function judgeSubtask(subtask) { export const judge = async (ctx) => { ctx.next({ status: STATUS.STATUS_COMPILING }); - ctx.time_limit_rate = ctx.getLang(ctx.lang).time_limit_rate; [ctx.executeUser, ctx.executeInteractor] = await Promise.all([ (() => { const copyIn = {}; diff --git a/packages/hydrojudge/src/judge/run.ts b/packages/hydrojudge/src/judge/run.ts index 6bcaad157..4a9383f0f 100644 --- a/packages/hydrojudge/src/judge/run.ts +++ b/packages/hydrojudge/src/judge/run.ts @@ -68,7 +68,7 @@ export const judge = async (ctx) => { stderr, copyIn, copyOut, - time: parseTimeMS(ctx.config.time || '1s'), + time: parseTimeMS(ctx.config.time || '1s') * ctx.execute.time, memory: parseMemoryMB(ctx.config.memory || '128m'), }, ); @@ -77,9 +77,9 @@ export const judge = async (ctx) => { if (!fs.existsSync(stdout)) fs.writeFileSync(stdout, ''); const message: string[] = []; if (status === STATUS.STATUS_ACCEPTED) { - if (time_usage_ms > ctx.config.time) { + if (time_usage_ms > parseTimeMS(ctx.config.time || '1s') * ctx.execute.time) { status = STATUS.STATUS_TIME_LIMIT_EXCEEDED; - } else if (memory_usage_kb > ctx.config.memory * 1024) { + } else if (memory_usage_kb > parseMemoryMB(ctx.config.memory || '128m') * 1024) { status = STATUS.STATUS_MEMORY_LIMIT_EXCEEDED; } } else if (code) {