mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
judge: support kattis checker (#947)
This commit is contained in:
1 parent
6f744e9f97
commit
085b6c9b4c
3 files changed
+37
-2
No files matched your search
@@ -228,6 +228,41 @@ const checkers: Record<string, Checker> = new Proxy({
|
||||
}
|
||||
return parse(stderr, config.score);
|
||||
},
|
||||
|
||||
// https://www.kattis.com/problem-package-format/spec/2023-07-draft.html#output-validator
|
||||
async kattis(config) {
|
||||
const { files, code } = await runQueued(`${config.execute} input answer_file feedback_dir`, {
|
||||
copyIn: {
|
||||
input: config.input,
|
||||
answer_file: config.output,
|
||||
'feedback_dir/placeholder': { content: '' },
|
||||
...config.copyIn,
|
||||
},
|
||||
stdin: config.user_stdout,
|
||||
copyOut: [
|
||||
'feedback_dir/score.txt?',
|
||||
'feedback_dir/judgemessage.txt?',
|
||||
'feedback_dir/teammessage.txt?',
|
||||
'feedback_dir/judgeerror.txt?',
|
||||
],
|
||||
});
|
||||
|
||||
const status = code === 42
|
||||
? STATUS.STATUS_ACCEPTED
|
||||
: code === 43
|
||||
? STATUS.STATUS_WRONG_ANSWER
|
||||
: STATUS.STATUS_SYSTEM_ERROR;
|
||||
|
||||
const score = status === STATUS.STATUS_ACCEPTED
|
||||
? config.score
|
||||
: +files['feedback_dir/score.txt'] || 0;
|
||||
|
||||
const message = status === STATUS.STATUS_SYSTEM_ERROR
|
||||
? files['feedback_dir/judgeerror.txt'] || `Checker exited with code ${code}`
|
||||
: files['feedback_dir/teammessage.txt'] || files['feedback_dir/judgemessage.txt'] || '';
|
||||
|
||||
return { status, score, message };
|
||||
},
|
||||
}, {
|
||||
get(self, key) {
|
||||
if (!self[key]) throw new FormatError('Unknown checker type {0}', [key]);
|
||||
|
||||
@@ -70,7 +70,7 @@ const problemConfigSchema: JSONSchema7 = {
|
||||
subType: { type: 'string' },
|
||||
langs: { type: 'array', items: { type: 'string' } },
|
||||
target: { type: 'string' },
|
||||
checker_type: { enum: ['default', 'lemon', 'syzoj', 'hustoj', 'testlib', 'strict', 'qduoj'] },
|
||||
checker_type: { enum: ['default', 'lemon', 'syzoj', 'hustoj', 'testlib', 'strict', 'qduoj', 'kattis'] },
|
||||
checker: {
|
||||
oneOf: [
|
||||
{ type: 'string', enum: testlibCheckers },
|
||||
|
||||
@@ -111,7 +111,7 @@ export default function ProblemType() {
|
||||
panel={(
|
||||
<div className="row">
|
||||
<FormItem columns={4} label="Interface">
|
||||
<ManagedSelect options={['syzoj', 'hustoj', 'qduoj', 'lemon']} formKey="checker_type" />
|
||||
<ManagedSelect options={['syzoj', 'hustoj', 'qduoj', 'lemon', 'kattis']} formKey="checker_type" />
|
||||
</FormItem>
|
||||
<SingleFileSelect formKey="checker" label="Checker" withLang />
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user