[Frontier-CS-1.1] Sync algorithmic problems 301-305#109
[Frontier-CS-1.1] Sync algorithmic problems 301-305#109joyemang33 merged 6 commits intoFrontierCS:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Frontier-CS algorithmic problem set 301–305 to match the current versions of synthetic problems 1–5, including updated scoring normalization rules and refreshed public testdata/checkers.
Changes:
- Replaced problem statements for 301–305 to reflect updated objective/scoring definitions.
- Added/updated per-problem checkers (
chk.cc) and configs (config.yaml) to implement the new baseline-relative scoring. - Refreshed public
testdata/*.in(with placeholder.ans) for the updated problem set.
Reviewed changes
Copilot reviewed 27 out of 108 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| algorithmic/problems/301/chk.cc | Checker for problem 301 scoring vs baseline selection. |
| algorithmic/problems/301/config.yaml | Runner limits and testcase count for problem 301. |
| algorithmic/problems/301/statement.txt | Updated problem 301 statement + scoring definition. |
| algorithmic/problems/301/testdata/1.in | Public input case 1 for problem 301. |
| algorithmic/problems/301/testdata/1.ans | Placeholder answer file for case 1. |
| algorithmic/problems/301/testdata/2.in | Public input case 2 for problem 301. |
| algorithmic/problems/301/testdata/2.ans | Placeholder answer file for case 2. |
| algorithmic/problems/301/testdata/3.in | Public input case 3 for problem 301. |
| algorithmic/problems/301/testdata/3.ans | Placeholder answer file for case 3. |
| algorithmic/problems/301/testdata/4.in | Public input case 4 for problem 301. |
| algorithmic/problems/301/testdata/4.ans | Placeholder answer file for case 4. |
| algorithmic/problems/301/testdata/5.in | Public input case 5 for problem 301. |
| algorithmic/problems/301/testdata/5.ans | Placeholder answer file for case 5. |
| algorithmic/problems/301/testdata/6.in | Public input case 6 for problem 301. |
| algorithmic/problems/301/testdata/6.ans | Placeholder answer file for case 6. |
| algorithmic/problems/301/testdata/7.in | Public input case 7 for problem 301. |
| algorithmic/problems/301/testdata/7.ans | Placeholder answer file for case 7. |
| algorithmic/problems/301/testdata/8.in | Public input case 8 for problem 301. |
| algorithmic/problems/301/testdata/8.ans | Placeholder answer file for case 8. |
| algorithmic/problems/301/testdata/9.in | Public input case 9 for problem 301. |
| algorithmic/problems/301/testdata/9.ans | Placeholder answer file for case 9. |
| algorithmic/problems/301/testdata/10.in | Public input case 10 for problem 301. |
| algorithmic/problems/301/testdata/10.ans | Placeholder answer file for case 10. |
| algorithmic/problems/302/chk.cc | Checker for problem 302 (bigram + motif penalty) scoring vs baseline string. |
| algorithmic/problems/302/config.yaml | Runner limits and testcase count for problem 302. |
| algorithmic/problems/302/generate_testdata.py | Script to generate public testdata for problem 302. |
| algorithmic/problems/302/statement.txt | Updated problem 302 statement + scoring definition. |
| algorithmic/problems/302/testdata/1.in | Public input case 1 for problem 302. |
| algorithmic/problems/302/testdata/1.ans | Placeholder answer file for case 1. |
| algorithmic/problems/302/testdata/2.in | Public input case 2 for problem 302. |
| algorithmic/problems/302/testdata/2.ans | Placeholder answer file for case 2. |
| algorithmic/problems/302/testdata/3.in | Public input case 3 for problem 302. |
| algorithmic/problems/302/testdata/3.ans | Placeholder answer file for case 3. |
| algorithmic/problems/302/testdata/4.in | Public input case 4 for problem 302. |
| algorithmic/problems/302/testdata/4.ans | Placeholder answer file for case 4. |
| algorithmic/problems/302/testdata/5.in | Public input case 5 for problem 302. |
| algorithmic/problems/302/testdata/5.ans | Placeholder answer file for case 5. |
| algorithmic/problems/302/testdata/6.in | Public input case 6 for problem 302. |
| algorithmic/problems/302/testdata/6.ans | Placeholder answer file for case 6. |
| algorithmic/problems/302/testdata/7.in | Public input case 7 for problem 302. |
| algorithmic/problems/302/testdata/7.ans | Placeholder answer file for case 7. |
| algorithmic/problems/302/testdata/8.in | Public input case 8 for problem 302. |
| algorithmic/problems/302/testdata/8.ans | Placeholder answer file for case 8. |
| algorithmic/problems/302/testdata/9.in | Public input case 9 for problem 302. |
| algorithmic/problems/302/testdata/9.ans | Placeholder answer file for case 9. |
| algorithmic/problems/302/testdata/10.in | Public input case 10 for problem 302. |
| algorithmic/problems/302/testdata/10.ans | Placeholder answer file for case 10. |
| algorithmic/problems/303/chk.cc | Checker for problem 303 (move sequence profit) scoring vs baseline (0 moves). |
| algorithmic/problems/303/config.yaml | Runner limits and testcase count for problem 303. |
| algorithmic/problems/303/statement.txt | Updated problem 303 statement + scoring definition. |
| algorithmic/problems/303/testdata/1.in | Public input case 1 for problem 303. |
| algorithmic/problems/303/testdata/1.ans | Placeholder answer file for case 1. |
| algorithmic/problems/303/testdata/2.in | Public input case 2 for problem 303. |
| algorithmic/problems/303/testdata/2.ans | Placeholder answer file for case 2. |
| algorithmic/problems/303/testdata/3.in | Public input case 3 for problem 303. |
| algorithmic/problems/303/testdata/3.ans | Placeholder answer file for case 3. |
| algorithmic/problems/303/testdata/4.in | Public input case 4 for problem 303. |
| algorithmic/problems/303/testdata/4.ans | Placeholder answer file for case 4. |
| algorithmic/problems/303/testdata/5.in | Public input case 5 for problem 303. |
| algorithmic/problems/303/testdata/5.ans | Placeholder answer file for case 5. |
| algorithmic/problems/303/testdata/6.in | Public input case 6 for problem 303. |
| algorithmic/problems/303/testdata/6.ans | Placeholder answer file for case 6. |
| algorithmic/problems/303/testdata/7.in | Public input case 7 for problem 303. |
| algorithmic/problems/303/testdata/7.ans | Placeholder answer file for case 7. |
| algorithmic/problems/303/testdata/8.in | Public input case 8 for problem 303. |
| algorithmic/problems/303/testdata/8.ans | Placeholder answer file for case 8. |
| algorithmic/problems/304/chk.cc | Checker for problem 304 (walk visiting all vertices) scoring vs baseline walk. |
| algorithmic/problems/304/config.yaml | Runner limits and testcase count for problem 304. |
| algorithmic/problems/304/statement.txt | Updated problem 304 statement + scoring definition. |
| algorithmic/problems/304/testdata/1.in | Public input case 1 for problem 304. |
| algorithmic/problems/304/testdata/1.ans | Placeholder answer file for case 1. |
| algorithmic/problems/304/testdata/2.in | Public input case 2 for problem 304. |
| algorithmic/problems/304/testdata/2.ans | Placeholder answer file for case 2. |
| algorithmic/problems/304/testdata/3.in | Public input case 3 for problem 304. |
| algorithmic/problems/304/testdata/3.ans | Placeholder answer file for case 3. |
| algorithmic/problems/304/testdata/4.in | Public input case 4 for problem 304. |
| algorithmic/problems/304/testdata/4.ans | Placeholder answer file for case 4. |
| algorithmic/problems/304/testdata/5.in | Public input case 5 for problem 304. |
| algorithmic/problems/304/testdata/5.ans | Placeholder answer file for case 5. |
| algorithmic/problems/304/testdata/6.in | Public input case 6 for problem 304. |
| algorithmic/problems/304/testdata/6.ans | Placeholder answer file for case 6. |
| algorithmic/problems/304/testdata/7.in | Public input case 7 for problem 304. |
| algorithmic/problems/304/testdata/7.ans | Placeholder answer file for case 7. |
| algorithmic/problems/304/testdata/8.in | Public input case 8 for problem 304. |
| algorithmic/problems/304/testdata/8.ans | Placeholder answer file for case 8. |
| algorithmic/problems/304/testdata/9.in | Public input case 9 for problem 304. |
| algorithmic/problems/304/testdata/9.ans | Placeholder answer file for case 9. |
| algorithmic/problems/304/testdata/10.in | Public input case 10 for problem 304. |
| algorithmic/problems/304/testdata/10.ans | Placeholder answer file for case 10. |
| algorithmic/problems/305/chk.cc | Checker for problem 305 (cascade flips on tree) scoring vs baseline BFS schedule. |
| algorithmic/problems/305/config.yaml | Runner limits and testcase count for problem 305. |
| algorithmic/problems/305/statement.txt | Updated problem 305 statement + scoring definition. |
| algorithmic/problems/305/testdata/1.in | Public input case 1 for problem 305. |
| algorithmic/problems/305/testdata/1.ans | Placeholder answer file for case 1. |
| algorithmic/problems/305/testdata/2.in | Public input case 2 for problem 305. |
| algorithmic/problems/305/testdata/2.ans | Placeholder answer file for case 2. |
| algorithmic/problems/305/testdata/3.in | Public input case 3 for problem 305. |
| algorithmic/problems/305/testdata/3.ans | Placeholder answer file for case 3. |
| algorithmic/problems/305/testdata/4.in | Public input case 4 for problem 305. |
| algorithmic/problems/305/testdata/4.ans | Placeholder answer file for case 4. |
| algorithmic/problems/305/testdata/5.in | Public input case 5 for problem 305. |
| algorithmic/problems/305/testdata/5.ans | Placeholder answer file for case 5. |
| algorithmic/problems/305/testdata/6.in | Public input case 6 for problem 305. |
| algorithmic/problems/305/testdata/6.ans | Placeholder answer file for case 6. |
| algorithmic/problems/305/testdata/7.in | Public input case 7 for problem 305. |
| algorithmic/problems/305/testdata/7.ans | Placeholder answer file for case 7. |
| algorithmic/problems/305/testdata/8.in | Public input case 8 for problem 305. |
| algorithmic/problems/305/testdata/8.ans | Placeholder answer file for case 8. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ### Baseline schedule `C_base` | ||
| The baseline schedule is computed deterministically as: | ||
| 1. Root the tree at vertex `1`. | ||
| 2. Compute a BFS order from `1` (ties broken by smaller vertex id). | ||
| 3. Use that BFS order as the baseline schedule. | ||
|
|
There was a problem hiding this comment.
The statement specifies the baseline BFS order uses “ties broken by smaller vertex id”, but the checker’s baselineBfsOrder is a standard queue BFS with sorted adjacency, which doesn’t guarantee smallest-id ordering among all vertices at the same depth. Please align the statement with the implemented tie-breaking, or update the checker to match the statement.
| // Allow completely empty output => interpret as 0 moves. | ||
| int S = 0; | ||
| if (!ouf.eof()) { | ||
| S = ouf.readInt(); | ||
| } else { | ||
| S = 0; | ||
| } | ||
|
|
||
| if (S < 0) quitf(_wa, "S is negative: %d", S); | ||
| if (S > L) quitf(_wa, "Too many moves: S=%d > L=%d", S, L); | ||
|
|
||
| vector<char> touched(N + 1, 0); | ||
| long long collected = 0; | ||
| auto touch = [&](int i) { | ||
| if (!touched[i]) { | ||
| touched[i] = 1; | ||
| collected += w[i]; | ||
| } | ||
| }; | ||
|
|
||
| touch(a); | ||
| touch(b); | ||
|
|
||
| int p = a, q = b; // previous pair (unordered conceptually) | ||
|
|
||
| for (int t = 1; t <= S; t++) { | ||
| int u = ouf.readInt(); | ||
| int v = ouf.readInt(); | ||
|
|
There was a problem hiding this comment.
Participant output is parsed with ouf.readInt() for S, u, and v. Non-integer tokens or missing values will follow testlib's PE/WA exit paths rather than the intended quitp(0.0, ...) (0 score) behavior for infeasible outputs. Consider reading tokens manually (as in problem 305) and calling quitp(0.0, ...) on any parse/range failure.
| // Read participant output: exactly K integers. | ||
| vector<int> moves; | ||
| moves.reserve(K); | ||
|
|
||
| for (int t = 1; t <= K; t++) { | ||
| if (ouf.seekEof()) { | ||
| quitp(0.0, "Output has fewer than K=%d integers", K); | ||
| } | ||
| int x = ouf.readInt(1, N, format("x[%d]", t)); | ||
| moves.push_back(x); | ||
| } |
There was a problem hiding this comment.
Participant output is parsed with ouf.readInt(1, N, ...). If a token is non-integer (or other parse issues), testlib will terminate with PE/WA instead of awarding 0 score as required by the statement for infeasible outputs. To keep invalid outputs scoring 0, parse tokens manually (or otherwise catch parse failures) and always exit via quitp(0.0, ...) on any format/range error.
|
|
||
| 1. Build a BFS tree rooted at `1` (ties broken by smaller vertex id). | ||
| 2. Perform a deterministic DFS traversal of that tree (children in increasing id order), producing an Euler walk that: | ||
| - starts at `1`, | ||
| - traverses each tree edge down and back up once, | ||
| - has length exactly `2·(N-1)` and visits all vertices. | ||
| 3. If this uses fewer than `K` moves, append additional moves by repeatedly traversing the smallest-id edge incident to vertex `1` back and forth until reaching exactly `K` moves. | ||
|
|
There was a problem hiding this comment.
The statement says the baseline BFS uses “ties broken by smaller vertex id”. The checker’s baseline builds the BFS tree using a normal queue and iterating each adjacency list in increasing order, which does not guarantee global smallest-id tie-breaking among vertices at the same distance. Please either (a) adjust the statement to describe the implemented deterministic BFS (queue BFS with sorted adjacency), or (b) change the baseline construction to actually enforce the stated tie-break rule.
What changed
Replace algorithmic problems 301-305 with the current contents of synthetic problems 1-5.
Why
These five problems were updated to match the latest scoring rubric normalization:
(baseline - x) / baseline(x - baseline) / xconfig.yamlImpact
algorithmic/problems/301now matchessynthetic_problems/1algorithmic/problems/302now matchessynthetic_problems/2algorithmic/problems/303now matchessynthetic_problems/3algorithmic/problems/304now matchessynthetic_problems/4algorithmic/problems/305now matchessynthetic_problems/5Validation
algorithmic/problems/301throughalgorithmic/problems/305