Repository navigation
Fail triangle solutions that ignore reachability - #446
Merged
Merged
Conversation
Every Mine Level Descent case gave the same answer to a correct bottom-up solution, to the sum of each level's minimum, and to a greedy walk that steps to the cheaper child, so both mistakes the problem's own pitfalls name passed all five cases. The two new cases put the cheapest chambers where the crew cannot reach them from each other, and each fails both wrong approaches while a correct solution still passes. Their labels join the tricky-case list so they stay.
Contributor
|
Thank @c14094071 for contributing! |
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.
Every built-in Mine Level Descent (
triangle) case gave the same answer to a correct bottom-up solution, to the sum of each level's minimum, and to a greedy walk that steps to the cheaper child, so both mistakes the problem's own pitfalls name passed all five cases.This adds two cases to the
trianglejudge inproblem-bank/judges.json, appended after the existing five so the scenario page's examples keep their indexes, and regeneratesweb/judges/mine-level-descent.jsonwithpython3 scripts/gen-problems.py. Each new case puts the cheapest chambers where a crew cannot reach them from each other, and each fails both wrong approaches:cheapest values not connected:[[-1],[2,3],[1,-1,-3]]cheaper step misses the deep saving:[[1],[2,3],[4,5,-10]]Both labels are added to the tricky-case list in
tests/web/contract.rs, so dropping either case failsstatic_problem_bank_and_judges_cover_each_problem.Validation, on Ubuntu 24.04 under WSL:
./scripts/test.sh portablepasses. Skipped only for missing local tools: commentflow, ruff, shfmt, shellcheck, cargo-audit, actionlint.cargo test --locked --test web static_problem_bank_and_judges_cover_each_problempasses.make webbuild of this branch, with C++: the bottom-up solution passes 7/7, and the level-minimum and greedy solutions from Mine Level Descent tests accept solutions that ignore which chambers are reachable #432 each pass 5/7, failing only the two new cases with the values in the table.Closes #432
Summary by cubic
Adds two test cases to the
trianglejudge that catch solutions which ignore reachability, closing #432. Previously, all five cases produced the same answer for a correct bottom-up solution, the sum of each level's minimum, and a greedy walk to the cheaper child, so the two incorrect approaches went undetected. The new cases place the cheapest chambers where the crew cannot reach them from each other, causing both wrong approaches to fail while correct solutions still pass.Written for commit d429ee7. Summary will update on new commits.