-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add example with custom checker #46
base: master
Are you sure you want to change the base?
Conversation
46d2925
to
730d243
Compare
|
||
|
||
def check(process_output, judge_output, judge_input, point_value, **kwargs): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra new line.
return CheckerResult(False, 0, "Sequence contains negative numbers!") | ||
|
||
# We check that the sequence sums to K | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much space
return CheckerResult(False, 0, "Sequence's sum is incorrect!") | ||
|
||
# The minimal possible product is 0, so we check if there exists a 0 in the sequence | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too much space.
730d243
to
2c9807a
Compare
# We again tell them they did not follow output specifications | ||
return CheckerResult(False, 0, "Sequence contains non-numeric values!") | ||
|
||
# We check that the sequence has N numbers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks weird
2c9807a
to
1907a3b
Compare
1907a3b
to
671f8fe
Compare
conditions_met += 1 | ||
else: | ||
return CheckerResult(False, 0, "Sequence's sum is incorrect!") | ||
# The minimal possible product is 0, so we check if there exists a 0 in the sequence |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: new line before this.
What's going on with this PR? |
if len(process_lines) != 1: | ||
# They did not follow output specifications | ||
# Thus they get a WA verdict, 0 points, and a message telling them their output is malformed | ||
return CheckerResult(False, 0, "Expected 1 line of output, got %d" % len(process_lines)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use single quotes and an f-string.
process_tokens = map(int, process_lines[0].split()) | ||
except (TypeError, ValueError): | ||
# We again tell them they did not follow output specifications | ||
return CheckerResult(False, 0, "Sequence contains non-numeric values!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
single quote
# We check all numbers in the sequence are non-negative | ||
if any(process_token < 0 for process_token in process_tokens): | ||
# We again tell them they did not follow output specifications | ||
return CheckerResult(False, 0, "Sequence contains negative numbers!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
single quote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to update problem_examples/README.md
please use a zip file instead of 5 text files
No description provided.