Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kiritofeng
Copy link
Member

No description provided.



def check(process_output, judge_output, judge_input, point_value, **kwargs):

Copy link
Member

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

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much space.

# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks weird

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
Copy link
Member

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.

@Riolku
Copy link
Contributor

Riolku commented Mar 11, 2022

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))
Copy link
Contributor

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!")
Copy link
Contributor

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!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

single quote

Copy link
Contributor

@int-y1 int-y1 left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants