@@ -16,14 +16,15 @@ function isValidConfig(config) {
1616 throw new FormatError ( 'Too many testcases. Cancelled.' ) ;
1717 }
1818 if ( config . type === 'communication' ) {
19+ config . num_processes ??= 2 ;
1920 if ( ! Number . isInteger ( config . num_processes ) || config . num_processes <= 0 ) {
2021 throw new FormatError ( 'Number of processes must be a positive integer for communication type.' ) ;
2122 }
2223 if ( config . num_processes > getConfig ( 'processLimit' ) ) {
2324 throw new FormatError ( 'Number of processes larger than processLimit' ) ;
2425 }
2526 }
26- const time = ( config . num_processes || 1 ) * Math . sum ( ...config . subtasks . flatMap ( ( subtask ) => subtask . cases . map ( ( c ) => c . time ) ) ) ;
27+ const time = config . num_processes * Math . sum ( ...config . subtasks . flatMap ( ( subtask ) => subtask . cases . map ( ( c ) => c . time ) ) ) ;
2728 if ( time > ( getConfig ( 'total_time_limit' ) || 60 ) * 1000 ) {
2829 throw new FormatError ( 'Total time limit longer than {0}s. Cancelled.' , [ + getConfig ( 'total_time_limit' ) || 60 ] ) ;
2930 }
@@ -35,14 +36,16 @@ function isValidConfig(config) {
3536 if ( config . type === 'interactive' && ! config . interactor ) {
3637 throw new FormatError ( 'Interactive problems require an interactor.' ) ;
3738 }
38- if ( config . multi_pass && ( ! Number . isInteger ( config . multi_pass ) || config . multi_pass < 2 || config . multi_pass > 20 ) ) {
39- throw new FormatError ( 'Multi Pass must be between 2 and 20.' ) ;
40- }
41- if ( config . multi_pass > 1 && ! [ 'default' , 'interactive' ] . includes ( config . type ) ) {
42- throw new FormatError ( 'Multi Pass only supported on default and interactive problems.' ) ;
43- }
44- if ( config . multi_pass > 1 && config . type === 'default' && ! [ 'testlib' , 'kattis' ] . includes ( config . checker_type ) ) {
45- throw new FormatError ( 'Multi Pass on default problems requires a testlib or kattis checker.' ) ;
39+ if ( config . multi_pass ) {
40+ if ( ! Number . isInteger ( config . multi_pass ) || config . multi_pass < 2 || config . multi_pass > 20 ) {
41+ throw new FormatError ( 'Multi Pass must be between 2 and 20.' ) ;
42+ }
43+ if ( ! [ 'default' , 'interactive' ] . includes ( config . type ) ) {
44+ throw new FormatError ( 'Multi Pass only supported on default and interactive problems.' ) ;
45+ }
46+ if ( config . type === 'default' && ! [ 'testlib' , 'kattis' ] . includes ( config . checker_type ) ) {
47+ throw new FormatError ( 'Multi Pass on default problems requires a testlib or kattis checker.' ) ;
48+ }
4649 }
4750}
4851
0 commit comments