feat(runner): compile Go and check answers per test group
This commit is contained in:
1 parent
e95c681165
commit
afee564bf4
61 files changed
+2592
-143
No files matched your search
+16
@@ -0,0 +1,16 @@
|
||||
# Custom checker of the pair task: accepts any two distinct 1-based
|
||||
# positions whose values add up to the target. Exit 0 accepts, 1 rejects.
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1]) as stream:
|
||||
lines = stream.read().split("\n")
|
||||
with open(sys.argv[3]) as stream:
|
||||
answer = stream.read().split()
|
||||
target = int(lines[0])
|
||||
values = [int(token) for token in lines[1].split()]
|
||||
try:
|
||||
first, second = (int(token) for token in answer)
|
||||
except ValueError:
|
||||
sys.exit(1)
|
||||
valid = 1 <= first <= len(values) and 1 <= second <= len(values) and first != second
|
||||
sys.exit(0 if valid and values[first - 1] + values[second - 1] == target else 1)
|
||||
Reference in new issue
Block a user