Skip to content
Merged
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
7 changes: 5 additions & 2 deletions examples/guess/problem.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
problem_format_version: 2023-07-draft
uuid: 5ca6ba5b-36d5-4eff-8aa7-d967cbc4375e
source: Kattis
license: cc by-sa

validation: custom interactive
type: interactive
name: Guess the Number

# Override standard limits: say that the TLE solutions provided should
# be at least 4 times above the time limit in order for us to be
# happy.
limits:
time_safety_margin: 4
time_multipliers:
time_limit_to_tle: 4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var för stor, för liten eller rätt. Du får bara $10$ gissningar, använd
dem klokt!


## Interaktion
# Interaktion
Ditt program ska skriva ut gissningar om talet.
En gissning är en rad som enbart innehåller ett heltal mellan $1$ och $1000$.
Efter varje gissning måste du flusha standard out.
Expand Down
6 changes: 3 additions & 3 deletions examples/oddecho/problem.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
problem_format_version: 2023-07-draft
uuid: 025dfeea-eb85-4532-94d1-3108ec03c80f
license: cc by-sa
author: Johan Sannemo
credits: Johan Sannemo
source: Principles of Algorithmic Problem Solving
type: scoring
name: Odd Echo
grading:
show_test_data_groups: true
Binary file added guess.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions problemtools/problem2pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def md2pdf(options: argparse.Namespace) -> bool:
print(f'Error compiling Markdown to pdf: {e.stderr}')
return False

# If success is not assigned somehow, it is considered a failure
success = False
try:
with open(temp_tex_file, 'r', encoding='utf-8') as f:
tex = f.read()
Expand Down Expand Up @@ -88,13 +90,11 @@ def replacer(match):
with open(temp_tex_file, 'w', encoding='utf-8') as f:
f.write(tex)

status = latex2pdf(options)
if status != 0:
return False
success = latex2pdf(options)
finally:
temp_tex_file.unlink()

return status == 0
return success


def latex2pdf(options: argparse.Namespace) -> bool:
Expand Down
6 changes: 6 additions & 0 deletions problemtools/verifyproblem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,12 @@ class OutputValidators(ProblemPart):
PART_NAME = 'output_validator'

def setup(self):
if (
self.problem.format.name != formatversion.VERSION_LEGACY
and (Path(self.problem.probdir) / 'output_validators').exists()
):
self.error('output_validators is not supported after Legacy; please use output_validator instead')

self._validators = run.find_programs(
os.path.join(self.problem.probdir, self.problem.format.output_validator_directory),
language_config=self.problem.language_config,
Expand Down