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

judge: pass result to checkers #1021

Merged
merged 1 commit into from
Mar 29, 2022
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
1 change: 1 addition & 0 deletions dmoj/graders/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def check_result(self, case, result):
binary_data=case.has_binary_data,
execution_time=result.execution_time,
problem_id=self.problem.id,
result=result,
)
except UnicodeDecodeError:
# Don't rely on problemsetters to do sane things when it comes to Unicode handling, so
Expand Down
9 changes: 9 additions & 0 deletions testsuite/check_memory_limit/checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dmoj.checkers import standard
from dmoj.result import Result


def check(process_output: bytes, judge_output: bytes, *, result: Result, **kwargs) -> bool:
if result.max_memory > 16384:
return False

return standard.check(process_output, judge_output, result=result, **kwargs)
4 changes: 4 additions & 0 deletions testsuite/check_memory_limit/init.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
checker: checker.py
points: 1
test_cases:
- {}
3 changes: 3 additions & 0 deletions testsuite/check_memory_limit/tests/c_blank/empty.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main() {
return 0;
}
5 changes: 5 additions & 0 deletions testsuite/check_memory_limit/tests/c_blank/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: C
time: 2
memory: 65536
source: empty.c
expect: AC
10 changes: 10 additions & 0 deletions testsuite/check_memory_limit/tests/cpp_too_much_memory/bloat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma GCC optimize "O0"

const int MN = 25 * 1024 * 1024;
char arr[MN];

int main() {
for (int i = 0; i < MN; ++i)
arr[i] = ' ';
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: CPP11
time: 2
memory: 65536
source: bloat.cpp
expect: WA