mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix #1200
This commit is contained in:
1 parent
8f8ab63f2c
commit
a6eee48a18
1 file changed
+7
-4
@@ -16,6 +16,7 @@ function isValidConfig(config) {
|
|||||||
throw new FormatError('Too many testcases. Cancelled.');
|
throw new FormatError('Too many testcases. Cancelled.');
|
||||||
}
|
}
|
||||||
if (config.type === 'communication') {
|
if (config.type === 'communication') {
|
||||||
|
config.num_processes ??= 2;
|
||||||
if (!Number.isInteger(config.num_processes) || config.num_processes <= 0) {
|
if (!Number.isInteger(config.num_processes) || config.num_processes <= 0) {
|
||||||
throw new FormatError('Number of processes must be a positive integer for communication type.');
|
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');
|
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) {
|
if (time > (getConfig('total_time_limit') || 60) * 1000) {
|
||||||
throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+getConfig('total_time_limit') || 60]);
|
throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+getConfig('total_time_limit') || 60]);
|
||||||
}
|
}
|
||||||
@@ -35,15 +36,17 @@ function isValidConfig(config) {
|
|||||||
if (config.type === 'interactive' && !config.interactor) {
|
if (config.type === 'interactive' && !config.interactor) {
|
||||||
throw new FormatError('Interactive problems require an 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)) {
|
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.');
|
throw new FormatError('Multi Pass must be between 2 and 20.');
|
||||||
}
|
}
|
||||||
if (config.multi_pass > 1 && !['default', 'interactive'].includes(config.type)) {
|
if (!['default', 'interactive'].includes(config.type)) {
|
||||||
throw new FormatError('Multi Pass only supported on default and interactive problems.');
|
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)) {
|
if (config.type === 'default' && !['testlib', 'kattis'].includes(config.checker_type)) {
|
||||||
throw new FormatError('Multi Pass on default problems requires a testlib or kattis checker.');
|
throw new FormatError('Multi Pass on default problems requires a testlib or kattis checker.');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function collectFiles(folder: string) {
|
async function collectFiles(folder: string) {
|
||||||
|
|||||||
Reference in new issue
Block a user