|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import fs from 'fs-extra';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
import yaml from 'js-yaml';
|
|
|
|
|
import { Dictionary } from 'lodash';
|
|
|
|
|
import { Dictionary, sum } from 'lodash';
|
|
|
|
|
import { argv } from 'yargs';
|
|
|
|
|
import { FormatError, SystemError } from './error';
|
|
|
|
|
import { parseTimeMS, parseMemoryMB, ensureFile } from './utils';
|
|
|
|
@ -285,11 +285,10 @@ function convertIniConfig(ini: string) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isValidConfig(config) {
|
|
|
|
|
if (config.count > (argv.max_testcases_count as string || 100)) throw new FormatError('Too many testcases. Cancelled.');
|
|
|
|
|
let total_time = 0;
|
|
|
|
|
for (const subtask of config.subtasks) {
|
|
|
|
|
total_time += subtask.time_limit_ms * subtask.cases.length;
|
|
|
|
|
if (config.count > (argv.max_testcases_count as string || 100)) {
|
|
|
|
|
throw new FormatError('Too many testcases. Cancelled.');
|
|
|
|
|
}
|
|
|
|
|
const total_time = sum(config.subtasks.map((subtask) => subtask.time_limit_ms * subtask.cases.length));
|
|
|
|
|
if (total_time > (+argv.max_time_limit || 60) * 1000) {
|
|
|
|
|
throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+argv.max_time_limit || 60]);
|
|
|
|
|
}
|
|
|
|
|