mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: fix #1200
This commit is contained in:
1 parent
8f8ab63f2c
commit
a6eee48a18
1 file changed
+12
-9
@@ -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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user