Skip to content

Submissions and expectations #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions support/schemas/submissions.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package problemformat

import "list"

#person: =~"^[^<]+(<[^>]+>)?$" // "Alice" or "Bob <bob@com>"

#verdict: "AC" | "WA" | "RTE" | "TLE"

let globbed_dirname = "[A-Za-z0-9*]([A-Za-z0-9_*-]{0,253}[A-Za-z0-9*])?"
#globbed_dirpath: =~"^(\(globbed_dirname)/)*\(globbed_dirname)$" & !~ "\\*\\*"
let globbed_filename = "([A-Za-z0-9*][A-Za-z0-9_.*-]{0,253}[A-Za-z0-9*]|\\*)"

#globbed_submissionpath: =~"^(\(globbed_dirname)/)*\(globbed_filename)$" & !~ "\\*\\*"
#Submissions: {
[#globbed_submissionpath]: #submission
}

#submission: {
language?: string
entrypoint?: string
author?: #person | [...#person]
#expectation
[=~"^(sample|secret|\\*)" & #globbed_dirpath]: #expectation
}

#expectation: {
permitted?: [#verdict, ...#verdict] // only these verdicts may appear
required?: [#verdict, ...#verdict] // at least one of these verdicts must appear
score?: int | [int, int] & list.IsSorted(list.Ascending)
use_for_timelmit?: false | "lower" | "upper"
}

// Play with me at https://cuelang.org/play/?id=3oy3DL9Hx5X#w=function&i=cue&f=eval&o=cue
76 changes: 76 additions & 0 deletions test/yaml/submissions/valid_yaml/valid.submissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
accepted/th.py:
permitted: ["AC"]
---
# applies to all submissions in accepted/
accepted:
permitted: ["AC"]
---
# this submissions passes all samples
accepted/a.py:
sample:
permitted: ["AC"]
---
# use globs for testnodes
accepted/a.py:
sample:
required: ["AC"]
secret/*/huge:
required: ["TLE"]
---
# specify many things for a submission
accepted/lovelace.ada:
author: Ada Lovelace <[email protected]>
score: [0, 20]
sample:
required: ["AC"]
secret/*/huge:
required: ["TLE"]
---
# More than one submission:
accepted/a.py:
score: [60, 80]
accepted/b.py:
score: [70, 74]
---
other/*.py:
required: ["TLE"]
---
other/*:
required: ["TLE"]
---
accepted:
author: "Ragnar van’t Höfnarß <foo_@bar>"
permitted: ["AC", "TLE", "WA"]
required: ["TLE"]
score: [40, 50]
sample: { required: [WA] }
sample/1 : { required: [AC] }
secret/*/huge: { required: [TLE] } # can use globbing
"*/sample/foo": { permitted: [AC, TLE] } # remember quotes bc * is weird in YAML
secret/*/*/1: { required: [TLE] } # no **
---
# The default directories from the draft specification
# ----------------------------------------------------
# All cases must be accepted.
accepted:
permitted: [AC]
# At least one case is not accepted.
rejected:
required: [RTE, TLE, WA]
# All cases AC or WA, at least one WA.
wrong_answer:
permitted: [AC, WA]
required: [WA]
# All cases AC or TLE, at least one TLE.
time_limit_exceeded:
permitted: [AC, TLE]
required: [TLE]
# All cases AC or RTE, at least one RTE.
run_time_error:
permitted: [AC, RTE]
required: [RTE]
# Must not WA, but fail at least once.
# Note that by default these are not used for determining the time limit.
brute_force:
permitted: [AC, RTE, TLE]
required: [RTE, TLE]
Loading