Repository navigation
Fix #212: draw problem 69's query pairs from a secret per-test seed - #213
Closed
XiaoyuanWang111 wants to merge 1 commit into
Closed
XiaoyuanWang111 wants to merge 1 commit into
XiaoyuanWang111 wants to merge 1 commit into
Conversation
The statement says the pair (u, v) of each round is chosen independently and uniformly at random. The interactor computed it from the round number instead: u = j % n + 1, v = (37 * j + 13) % n + 1, the same on every test. A program that prints the n shortest words and then these pairs, without reading a single power, was accepted on all 10 tests at 67.29 points, above the 60-point reference. Each testdata/N.ans now holds a distinct secret 63-bit seed on a second line, drawn with Python's secrets.randbits(63). The interactor reads it and draws the q pairs from std::mt19937_64(seed) before it reads any word. A rejection loop keeps each index exactly uniform on [1, n]. A missing seed is a judge failure (_fail). Problem 59 gets its hidden array from a seed in the answer file in the same way. The wrong-answer messages no longer print the pair that was asked, since that pair is now secret. algorithmic/tests/test_problem69.py checks that the old replay is rejected on every test, that the seeded pairs are the ones asked and are accepted with the unchanged score formula, that the pair sequences are pinned, and that a missing seed fails.
Contributor
Author
|
Thanks, and no worries! Closing in favor of #214. |
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.
Summary
Fixes #212.
The statement of problem 69 says the pair (u, v) of each round is chosen independently and uniformly at random. The interactor computed it from the round number (
u = j % n + 1,v = (37 * j + 13) % n + 1), the same on every test, so the program in the issue was accepted on all 10 tests at 67.29 points without reading a power.testdata/N.ansnow holds a distinct secret 63-bit seed on a second line, drawn with Python'ssecrets.randbits(63). The first line is unchanged.std::mt19937_64(seed)before it reads any word. A rejection loop keeps each index exactly uniform on [1, n]. A missing seed is a judge failure (_fail). Problem 59 gets its hidden array from a seed in the answer file in the same way (Fix #208: draw problem 59's hidden array from a secret per-test seed #211).The statement, the scoring formula and the protocol are unchanged, and a test still asks the same pairs on every run. Like the seeds of problem 59, these seeds are public in this repository; the fix removes the answer that needs no outside data.
Type of Change
Testing
With g++ 13.3 (
-O2 -std=gnu++17):algorithmic/tests/test_problem69.py: all 27 tests pass. On main all 27 fail: the 10 that replay the old pairs fail because the transcript is accepted at Ratio 0.6729, and the other 17 because main has no seed.python -m pytest algorithmic/testsgives 244 passed and no failure; the 4 errors intest_problem36_239.pyoccur on main as well, because that file reads commit 65117c99, which is not in the public repository.algorithmic/solutions/69, each played on tests 1, 5 and 10 against the interactor before and after: every one gets the same score on every test. Five of them score above zero (gpt5.2.cppand three of its variants at 30.4 to 30.8,gpt5_high.cppat 19.1 to 19.3); the other 40 score 0 with both.The
validate-algorithmiccheck will fail here:scripts/validate_problems.pyreports a missing reference solution, because problem 69 has noreference.cpp. The same check failed on #206, #210 and #211, which also changed problems without one.Checklist
CI Validation (for new problems)