From a6eee48a1890709ecc6118648e292a2fa003fc4d Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 23 Aug 2026 05:17:11 +0000 Subject: [PATCH] judge: fix #1200 --- packages/hydrojudge/src/cases.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/hydrojudge/src/cases.ts b/packages/hydrojudge/src/cases.ts index 773399ec8..35dbb388b 100644 --- a/packages/hydrojudge/src/cases.ts +++ b/packages/hydrojudge/src/cases.ts @@ -16,6 +16,7 @@ function isValidConfig(config) { throw new FormatError('Too many testcases. Cancelled.'); } if (config.type === 'communication') { + config.num_processes ??= 2; if (!Number.isInteger(config.num_processes) || config.num_processes <= 0) { throw new FormatError('Number of processes must be a positive integer for communication type.'); } @@ -23,7 +24,7 @@ function isValidConfig(config) { throw new FormatError('Number of processes larger than processLimit'); } } - const time = (config.num_processes || 1) * Math.sum(...config.subtasks.flatMap((subtask) => subtask.cases.map((c) => c.time))); + const time = config.num_processes * Math.sum(...config.subtasks.flatMap((subtask) => subtask.cases.map((c) => c.time))); if (time > (getConfig('total_time_limit') || 60) * 1000) { throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+getConfig('total_time_limit') || 60]); } @@ -35,14 +36,16 @@ function isValidConfig(config) { if (config.type === 'interactive' && !config.interactor) { throw new FormatError('Interactive problems require an interactor.'); } - if (config.multi_pass && (!Number.isInteger(config.multi_pass) || config.multi_pass < 2 || config.multi_pass > 20)) { - throw new FormatError('Multi Pass must be between 2 and 20.'); - } - if (config.multi_pass > 1 && !['default', 'interactive'].includes(config.type)) { - throw new FormatError('Multi Pass only supported on default and interactive problems.'); - } - if (config.multi_pass > 1 && config.type === 'default' && !['testlib', 'kattis'].includes(config.checker_type)) { - throw new FormatError('Multi Pass on default problems requires a testlib or kattis checker.'); + if (config.multi_pass) { + if (!Number.isInteger(config.multi_pass) || config.multi_pass < 2 || config.multi_pass > 20) { + throw new FormatError('Multi Pass must be between 2 and 20.'); + } + if (!['default', 'interactive'].includes(config.type)) { + throw new FormatError('Multi Pass only supported on default and interactive problems.'); + } + if (config.type === 'default' && !['testlib', 'kattis'].includes(config.checker_type)) { + throw new FormatError('Multi Pass on default problems requires a testlib or kattis checker.'); + } } }