judge: add communication problem support (#834) (#925)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
Milmonandundefined authored and GitHub committed 2025-01-21 07:33:39 +08:00
1 parent abf1c7205e
commit ebc586daba
15 files changed
+151 -33

No files matched your search

@@ -52,7 +52,7 @@ const problemConfigSchema: JSONSchema7 = {
properties: {
redirect: { type: 'string', pattern: '[0-9a-zA-Z_-]+\\/[0-9]+' },
key: { type: 'string', pattern: '[0-9a-f]{32}' },
type: { enum: ['default', 'interactive', 'submit_answer', 'objective', 'remote_judge'] },
type: { enum: ['default', 'interactive', 'communication', 'submit_answer', 'objective', 'remote_judge'] },
subType: { type: 'string' },
langs: { type: 'array', items: { type: 'string' } },
target: { type: 'string' },
@@ -64,6 +64,8 @@ const problemConfigSchema: JSONSchema7 = {
],
},
interactor: { type: 'string', pattern: '\\.' },
manager: { type: 'string', pattern: '\\.' },
num_processes: { type: 'number', minimum: 1, maximum: 5 },
validator: { type: 'string', pattern: '\\.' },
user_extra_files: { type: 'array', items: { type: 'string' } },
judge_extra_files: { type: 'array', items: { type: 'string' } },
@@ -29,9 +29,9 @@ interface Props {
const configKey = [
'type', 'subType', 'target', 'score', 'time',
'memory', 'filename', 'checker_type', 'checker', 'interactor',
'validator', 'user_extra_files', 'judge_extra_files', 'detail', 'outputs',
'redirect', 'cases', 'subtasks', 'langs', 'key',
'time_limit_rate', 'memory_limit_rate',
'manager', 'num_processes', 'validator', 'user_extra_files', 'judge_extra_files',
'detail', 'outputs', 'redirect', 'cases', 'subtasks',
'langs', 'key', 'time_limit_rate', 'memory_limit_rate',
];
const subtasksKey = [
@@ -12,6 +12,7 @@ export default function ProblemType() {
const Type = useSelector((state: RootState) => state.config.type);
const checkerType = useSelector((state: RootState) => state.config.checker_type);
const filename = useSelector((state: RootState) => state.config.filename);
const numProcesses = useSelector((state: RootState) => state.config.num_processes);
const subType = useSelector((state: RootState) => state.config.subType);
const checker = useSelector((state: RootState) => state.config.checker);
const [category, setCategory] = React.useState('');
@@ -133,6 +134,25 @@ export default function ProblemType() {
</div>
)}
/>
<Tab
id="communication"
title={i18n('problem_type.communication')}
panel={(
<div className="row">
<FormItem columns={6} label="Manager">
<SingleFileSelect formKey="manager" />
</FormItem>
<FormItem columns={6} label="Number of Processes">
<input
defaultValue={numProcesses || 2}
placeholder="2"
onChange={(ev) => dispatch(({ type: 'CONFIG_FORM_UPDATE', key: 'num_processes', value: +ev.currentTarget.value }))}
className="textbox"
/>
</FormItem>
</div>
)}
/>
<Tab
id="submit_answer"
title={i18n('problem_type.submit_answer')}
+1
View File
@@ -29,6 +29,7 @@ problem_solution: Problem Solution
problem_submit: Problem Submit
problem_type.default: 'Type: Default'
problem_type.interactive: 'Type: Interactive'
problem_type.communication: 'Type: Communication'
problem_type.objective: 'Type: Objective'
problem_type.remote_judge: 'Type: RemoteJudge'
problem_type.submit_answer: 'Type: SubmitAnswer'
+1
View File
@@ -700,6 +700,7 @@ problem_solution: 题解
problem_submit: 递交代码
problem_type.default: 传统题
problem_type.interactive: 交互题
problem_type.communication: 通信题
problem_type.objective: 客观题
problem_type.remote_judge: 远端评测题
problem_type.submit_answer: 提交答案题