Fix #185: align problem 213 checker with the documented output format - #188
Merged
joyemang33 merged 1 commit intoSep 10, 2026
Merged
Conversation
…put format
The statement specifies three integers per operation (l r direction), and
the sample plus every answer file use that format, but chk.cc read only
two: `x=ouf.readInt(); y=x+m-1; z=ouf.readInt();`. It derived the right
endpoint from the segment length and then consumed `r` as the direction,
so the first ordinary operation was misparsed and any statement-compliant
submission was rejected before scoring. The repo's own testdata answers
failed against it.
- chk.cc: read l, r and d as three separate integers, keeping the existing
interval-length, bounds and direction validation.
- testdata/1.ans: replace an invalid answer (x=3 for n=2, and an operation
with no direction) with `2 / 1 / 1 2 0`.
- statement.txt: describe x and m on separate lines, matching the sample
and the answer files, and spell out the l/r/d constraints.
- config.yaml: raise the time limit to the documented 5s.
Verified: all three testdata answers now score (1.0, 0.9577, 0.9952), the
statement's sample scores 1.0, and illegal outputs (wrong interval length,
r > n, direction not in {0,1}) are still rejected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #185.
Problem
The statement for problem 213 specifies three integers per operation (
l r direction), and the sample output plus every answer file intestdata/use that format. Butalgorithmic/problems/213/chk.ccread only two integers per operation:x=ouf.readInt(); y=x+m-1; z=ouf.readInt();It derived the right endpoint from the segment length and then consumed
ras the direction. For a statement-compliantl r d, the direction check(z!=0 && z!=1)fails on the first ordinary operation, so the checker quit withwrong answer Your answer is not legalbefore validating the sequence or computing a score. No submission following the published specification could score.This was verified against the repository's own data: compiling the pre-fix checker and feeding it
testdata/{1,2,3}.ansas the contestant output rejected all three.Changes
chk.cc— readl,randdas three separate integers. The existing interval-length (r - l + 1 == x), bounds and direction validation is unchanged, so it now actually enforces the documented contract.testdata/1.ans— was3 / 1 / 1 2: segment length 3 for an input withn = 2, and an operation with no direction field. Replaced with the valid2 / 1 / 1 2 0.statement.txt— the prose claimedxandmshare the first line while the sample printed them on separate lines. Aligned the prose to the sample, since the sample and all three answer files already agreed. Also spelled out ther - l + 1 = xand1 <= l <= r <= nconstraints that the checker enforces.config.yaml— time limit2s-> the documented5s.Scoring logic, subtasks and the
23n/230nthresholds are untouched.Verification
Checker built against
algorithmic/judge/include/testlib.h.Repository answer files, before vs. after:
1.answrong answer Your answer is not legal2.answrong answer Your answer is not legal3.answrong answer Your answer is not legalThe statement's own worked example (
n = 5,4 2 3 5 1) now scores 1.0.Illegal outputs are still rejected, confirming the validation was not loosened:
x->Your answer is not legalr > n->Your answer is not legal{0, 1}->Your answer is not legalYour answer is wrongEnd-to-end, the real submission at
algorithmic/solutions/213/gpt5.cppwent from rejected on all three cases to scoring 1.0 / 0.6299 / 0.6305. Every model solution inalgorithmic/solutions/213/emits the three-integerl r dform, which independently corroborates that the statement, not the checker, held the correct specification.🤖 Generated with Claude Code