Update dataset
Browse files
data/test-00000-of-00001.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
| 34 |
{"problem_id": "142", "category": "algorithmic", "statement": "Ball Game\n\nYou are given n+1 poles numbered from 1 to n+1. Initially, poles 1 through n each contain m balls stacked vertically, while pole n+1 is empty. There are n*m balls in total, with n different colors, where each color appears exactly m times.\n\nYour task is to rearrange the balls so that all balls of the same color are on the same pole. The final distribution of colors to poles does not matter, as long as each pole contains balls of at most one color.\n\nYou can perform operations to move balls between poles. In one operation, you can move the topmost ball from pole x to the top of pole y, subject to the following constraints:\n- Pole x must have at least one ball\n- Pole y must have at most m-1 balls\n\nYour goal is to minimize the number of operations needed. You must use at most 2,000,000 operations.\n\nInput\n\nThe first line contains two integers n and m (2 ≤ n ≤ 50, 2 ≤ m ≤ 400) — the number of colors and the number of balls of each color.\n\nThe next n lines each contain m integers. The i-th line describes the color of balls on pole i from bottom to top. (colors are numbered from 1 to n).\n\nOutput\n\nOn the first line, print a single integer k (0 ≤ k ≤ 2,000,000) — the number of operations in your solution.\n\nThe next k lines should each contain two integers x and y (1 ≤ x, y ≤ n+1, x ≠ y), indicating that you move the topmost ball from pole x to pole y.\n\nIt is guaranteed that a valid solution exists.\n\nScoring\n\nYou will be graded based on the number of operations you use.\nIn order to receive any points, you must use no more than 2,000,000 operations.\nAfter that, your answer will be compared to a reference solution ref_ops. Your final score will be calculated as the average of 100 * min((ref_ops + 1) / (your_ops + 1), 1) across all test cases.\n\nTime limit: 4 seconds\nMemory limit: 512 MB\n\nSample Input:\n2 3\n1 1 2\n2 1 2\n\nSample Output:\n6\n1 3\n2 3\n2 3\n3 1\n3 2\n3 2", "config": "type: default\ntime: 4s\nmemory: 512m\nchecker: chk.cc\nsubtasks:\n - score: 100\n n_cases: 10"}
|
| 35 |
{"problem_id": "143", "category": "algorithmic", "statement": "Problem: Texas Hold’em Training (Terminal I/O Interactive)\n\nTime limit: 10 seconds\nMemory limit: 512 MB\n\nOverview\nYou will write a program that plays a large number of very simplified heads-up Texas Hold’em hands against a fixed opponent policy. The judge runs the game and reveals exactly the information you are allowed to know. Your program must decide whether to CHECK, FOLD, or RAISE an integer number of chips each betting round to maximize your chip profit. Interaction is via standard input/output (stdin/stdout). You must flush after every line you print.\n\nCards, ranks, and hand comparison\n- Deck: 52 cards, 4 suits labeled 0,1,2,3. Each suit has 13 values labeled 1..13 corresponding to 2,3,4,5,6,7,8,9,T,J,Q,K,A (in strictly increasing order).\n- A 5-card hand type ranking (highest to lowest):\n 1) Straight flush (a straight with all five cards same suit)\n 2) Four of a kind\n 3) Full house (three of a kind + a pair)\n 4) Flush (five cards same suit)\n 5) Straight (five consecutive values; A-2-3-4-5 is valid and is the lowest straight; K-A-2-3-4 is not)\n 6) Three of a kind\n 7) Two pairs\n 8) One pair\n 9) High card\n- Comparing two hands:\n - If hand types differ, higher type wins.\n - If both are straights or straight flushes: compare by the straight’s rank. Ten-to-Ace (T-J-Q-K-A) is the highest; A-2-3-4-5 is the lowest.\n - Otherwise, sort the 5 cards by the tuple (multiplicity, value) in descending order, where multiplicity is how many times the value appears in the hand. Compare these 5-card sequences lexicographically. Suits never break ties beyond determining flush/straight flush.\n - Examples:\n - Same-suit 5-6-7-8-9 > same-suit A-2-3-4-5.\n - Same-suit A-2-3-4-5 > same-suit 2-4-5-6-7 (the latter is not a straight).\n - 3-3-8-8-K > 5-5-7-7-A (two pairs with higher top pair/tiebreakers).\n - Q-Q-Q-T-T > J-J-J-A-A.\n- Board-of-7 rule: At showdown each player forms their best 5-card hand from their 7 available cards (2 private + 5 community). The higher best 5-card hand wins; equal best hands tie.\n\nGame flow (per hand)\n- Shuffling and dealing:\n - The 52 cards are uniformly randomly permuted.\n - You (Alice) receive the top 2 cards; the opponent (Bob) receives the next 2 (unknown to you).\n - A “pot” starts with 10 chips. Both players start the hand with 100 chips behind (stacks). All chip counts are integers.\n- Four betting rounds, with at most one action from you and one response from Bob per round:\n 1) Round 1 (preflop): no community cards are visible.\n 2) Reveal 3 community cards (the flop).\n 3) Round 2.\n 4) Reveal 1 community card (the turn).\n 5) Round 3.\n 6) Reveal 1 community card (the river).\n 7) Round 4.\n- Your options when it is your turn in any round:\n - CHECK: no chips move.\n - FOLD: the hand ends immediately; Bob wins the entire pot.\n - RAISE x: choose an integer x with 1 ≤ x ≤ your current stack; you move x chips into the pot.\n- Bob’s response after your action:\n - If you CHECK: Bob always CHECKS (no bet this round).\n - If you RAISE x: Bob either FOLDs (you win the pot immediately) or CALLs (she moves x chips into the pot).\n - It is guaranteed Bob always has enough chips to call any allowed raise x (by construction of this single-raise-per-round process).\n- Showdown and payouts:\n - If nobody folds by the end of Round 4, reveal all community cards (already visible) and both hole cards are implicitly known to the judge; the judge determines the winner using the rules above.\n - Winner gets the entire pot; if tie, the pot is split evenly (integer arithmetic; pot is always even here).\n - Your profit for the hand is (your ending stack) − 100. Positive means you won chips; negative means you lost chips.\n\nOpponent policy (Bob)\n- If you CHECK, she CHECKs.\n- If you RAISE x, she compares:\n - EV(FOLD) = (her current stack) − 100.\n - EV(CALL) = estimated via 100 Monte Carlo rollouts:\n - Consider all yet-unseen cards (your hole cards are hidden from Bob, and unrevealed community cards are unknown).\n - For each rollout: take a uniform random permutation of the remaining unseen cards; assign them to all unknown positions in natural order (your hidden cards remain unknown to Bob but are assigned in the simulation; remaining community cards are dealt next).\n - Assume that after she calls now, you will CHECK in all future rounds (this is how she evaluates the call).\n - Compute her resulting profit in that simulation.\n - EV(CALL) is the average over the 100 rollouts.\n - She CALLs if and only if EV(CALL) > EV(FOLD); otherwise she FOLDs.\n\nTerminal I/O protocol\nAll lines are plain ASCII tokens separated by spaces. You must flush after every line you print. If you ever read -1, you must exit immediately.\n\nStart of the match\n- Read a single integer G: the number of hands the judge will play (up to 10,000 in official tests).\n\nPer-hand loop\nThe judge will drive the hand by repeatedly sending a STATE describing your next decision point. After a STATE, you may ask for Monte Carlo equity estimates, then you must output exactly one ACTION.\n\nState description (from judge to you)\n- STATE h r a b P k\n - h: 1-based hand index\n - r: current round in {1,2,3,4} (you act first in each round)\n - a: your current stack (chips behind)\n - b: Bob’s current stack\n - P: current pot size\n - k: number of currently revealed community cards; k ∈ {0,3,4,5}\n- ALICE c1 v1 c2 v2\n - Your two hole cards as (suit, value) pairs; suit in [0..3], value in [1..13] for 2..A\n- BOARD followed by 2k integers\n - Exactly k cards, each as (suit, value); if k = 0, the line is just “BOARD” with no numbers.\n\nOptional helper query (from you to judge)\n- RATE t\n - t: positive integer number of sampling rollouts the judge should use to estimate your win/draw rates from the current partial state (this mimics getRatesBySampling). The judge responds:\n - RATES w d\n - w: estimated probability that your final 7-card hand will be strictly better than Bob’s (double)\n - d: estimated probability of a tie (double)\n - The sampling completes the currently unknown cards (Bob’s hole, unrevealed community) uniformly at random from the remaining deck.\n - Global budget: sum of all t over the entire match must be ≤ 3,000,000. If you exceed this, the judge may reply with -1 and terminate. RATE does not advance the hand; you may issue multiple RATE queries per STATE within the budget.\n\nYour decision (exactly one per STATE)\n- ACTION CHECK\n- ACTION FOLD\n- ACTION RAISE x\n - x must be an integer with 1 ≤ x ≤ your current stack a.\n\nJudge’s immediate response after your ACTION\n- If ACTION CHECK:\n - OPP CHECK\n - If r < 4, dealing proceeds and you will receive the next STATE for round r+1 (with updated k = 3,4,5).\n - If r = 4, the hand ends by showdown; judge then prints RESULT delta.\n- If ACTION RAISE x:\n - OPP FOLD\n - The hand ends immediately; judge prints RESULT delta (your profit for this hand).\n - or OPP CALL x\n - The hand continues. If r < 4, the judge proceeds to the next STATE (round r+1 with more community cards). If r = 4, the hand ends by showdown and judge prints RESULT delta.\n- RESULT delta\n - delta is your integer profit for this hand: ending stack − 100. The next hand then begins (or the match ends if h = G).\n\nEnd of the match\n- After all G hands, the judge prints:\n - SCORE W\n - W is your average profit per hand (double), i.e., mean of all delta.\n\nValidity and termination\n- Any malformed command, out-of-range raise, or protocol violation may cause the judge to print -1 and terminate immediately; your program must exit upon reading -1.\n- Always flush after printing RATE or ACTION (e.g., in C++: cout << line << endl; or fflush(stdout)).\n\nConstraints and guarantees\n- G ≤ 10,000 in official tests.\n- Sum of t over all RATE queries ≤ 3,000,000.\n- All chip movements are integers. Pot and stacks fit in 32-bit signed integers in all official tests.\n- The hidden deck for each hand is fixed before the hand begins and does not depend on your queries.\n- With this single-raise-per-round structure and symmetric stacks, Bob always has enough chips to CALL any legal RAISE you declare.\n\nScoring\nOnly programs that follow the protocol, do not exceed the RATE budget, and finish all hands are scored.\n\nLet W be the final average profit per hand printed by the judge (the SCORE value). Your points are a piecewise-linear function of W:\n\n- If W ≤ 8.0: score = 0.\n- If 8.0 < W ≤ 11.0: score increases linearly from 0 to 40:\n score = round(13.3 × (W − 8)).\n- If 11.0 < W ≤ 14.0: score increases linearly from 40 to 82:\n score = 40 + round(14 × (W − 11)).\n- If 14.0 < W: score increases linearly from 82 to Infinite:\n score = 82 + round(3 × (W − 14)).\n\n\nInterpretation:\n- Around W ≥ 11 indicates you beat a simple baseline (roughly “Small Task”).\n- Around W ≥ 16 indicates a strong strategy (roughly “Large Task”).\n\nExample interaction (illustrative only)\nJudge: 1\nJudge: STATE 1 1 100 100 10 0\nJudge: ALICE 0 12 2 1\nJudge: BOARD\nYou: RATE 100\nJudge: RATES 0.421000 0.010000\nYou: ACTION RAISE 5\nJudge: OPP FOLD\nJudge: RESULT 15\nJudge: SCORE 15.000000\n\nNotes and clarifications\n- Card encoding:\n - Each card is printed as two integers: suit in [0..3], value in [1..13] corresponding to 2..A.\n - Community cards appear in deal order on BOARD (first the 3-card flop, then turn, then river).\n- You do not need to implement hand evaluation to be correct; the judge handles showdowns. However, to plan your actions you may use RATE queries (within budget) or implement your own simulation/evaluation.\n- Precision of RATES and SCORE is implementation-defined by the judge; treat them as doubles. Do not rely on a fixed number of decimals.\n- If you ever read -1, exit immediately without printing anything further.\n\nStrategy discussion (non-binding)\n- The opponent’s CALL decision underestimates your future aggression (she assumes you will CHECK afterwards), which can be exploited by well-timed raises.\n- RATE queries give you (win, tie) probabilities under random completions; combined with current pot and effective stacks, you can estimate immediate fold equity versus call equity to choose raise sizes.\n- Budget your RATE calls: preflop and early-street coarse estimates (small t) and larger t near pivotal decisions can perform well within the 3,000,000 budget.\n", "config": "# Set the problem type to interactive\ntype: interactive\n\n# Specify the interactor source file\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 100s\nmemory: 512m\n\n# The subtasks section works the same way\nsubtasks:\n - score: 100\n n_cases: 10 # Looks for 1.in, 2.in, ... 5.in"}
|
| 36 |
{"problem_id": "144", "category": "algorithmic", "statement": "Find Median\n\nThis is an interactive problem.\n\nThere is a hidden permutation p of length n, where n is even.\nYou are allowed to make queries by choosing a subsequence of indices with even length k (where 4 ≤ k ≤ n). For a chosen subsequence, the interactor will return the two median values.\nFor a subsequence of even length k, the two medians are defined as the k/2-th and (k/2+1)-th smallest values in that subsequence.\n\nYour goal is to find the index of the two medians in permutation p. This problem is graded based on the number of queries you use. In order to receive any points, you must use no more than 500 queries. After that, your answer will be compared to a solution ref_queries. Your final score will be calculated as the average of 100 * min(ref_queries / your_queries, 1) across all cases.\n\nInput\n\nThe first line contains a single integer n (6 ≤ n ≤ 100, n is even) — the length of the hidden permutation.\n\nInteraction\n\nTo make a query, output one line in the following format:\n0 k x1 x2 ... xk\n\nwhere:\n- k is the length of the subsequence (4 ≤ k ≤ n, k must be even)\n- x1, x2, ..., xk are distinct indices between 1 and n\n\nAfter each query, read a line containing two integers m1 and m2 (1 ≤ m1 < m2 ≤ n) — the two median values of the subsequence.\n\nWhen you have found the answer, output one line in the following format:\n1 i1 i2 - the index of the two medians.\n\nAfter printing the answer, your program should terminate immediately.\n\nNote: The interactor is non-adaptive. The permutation is fixed before you start querying.\n\nTo flush your output, use:\n- fflush(stdout) or cout.flush() in C++\n- System.out.flush() in Java\n- stdout.flush() in Python\n\nExample Interaction\n\nInput:\n6\n\n3 4\n\n3 4\n\n2 3\n\nOutput:\n\n0 6 1 2 3 4 5 6\n\n0 4 3 6 1 5\n\n0 4 3 6 2 5\n\n1 3 6\n\nTime limit: 4 seconds\nMemory limit: 512 MB", "config": "type: interactive\ninteractor: interactor.cc\ntime: 4s\nmemory: 512m\nsubtasks:\n - score: 100\n n_cases: 10"}
|
| 37 |
-
{"problem_id": "145", "category": "algorithmic", "statement": "#
|
| 38 |
{"problem_id": "147", "category": "algorithmic", "statement": "Problem Statement\n--------\nAtCoder has decided to place web advertisements of $n$ companies on the top page.\nThe space for placing advertisements is a square of size 10000 x 10000.\nThe space for each company must be an axis-parallel rectangle with positive area, and the coordinates of the vertices must be integer values.\nDifferent rectangles may touch on their sides, but they must not overlap. In other words, the common area must not have positive area.\nIt is allowed to leave some free space that does not belong to any ad.\n\nPresident Takahashi asked each company for their desired location and area. Company $i$ wants an ad space with area $r_i$ including point $(x_i+0.5, y_i+0.5)$.\nThe satisfaction level $p_i$ of company $i$ is determined as follows.\n\n- If the ad space for company $i$ does not contain the point $(x_i+0.5, y_i+0.5)$, then $p_i = 0$.\n- If the ad space for company $i$ contains the point $(x_i+0.5, y_i+0.5)$ and the area is $s_i$, then $p_i = 1 - (1 - \\min(r_i,s_i) / \\max(r_i, s_i))^2$.\n\nYour task is to determine the placement of the ads so that the sum of the satisfaction levels is maximized.\nYou will get a score of $10^9 \\times \\sum_{i=0}^{n-1} p_i / n$ rounded to the nearest integer.\n\n\n\nInput\n--------\nInput is given from Standard Input in the following format:\n\n~~~\n$n$\n$x_0$ $y_0$ $r_0$\n$\\vdots$\n$x_{n-1}$ $y_{n-1}$ $r_{n-1}$\n~~~\n\n- $50\\leq n\\leq 200$\n- $x_i$ and $y_i$ are integers satisfying $0\\leq x_i\\leq 9999$ and $0\\leq y_i\\leq 9999$. For any $i\\neq j$, $(x_i,y_i)\\neq (x_j,y_j)$ holds.\n- $r_i$ is an integer at least one and satisfies $\\sum_{i=0}^{n-1} r_i=10000\\times 10000$.\n\nOutput\n--------\nLet $(a_i, b_i)$ and $(c_i, d_i)$ ($0\\leq a_i<c_i\\leq 10000$, $0\\leq b_i<d_i\\leq 10000$) be the coordinates of the two diagonal vertices of the rectangle representing the ad space for company $i$.\nOutput to standard output in the following format.\n\n~~~\n$a_0$ $b_0$ $c_0$ $d_0$\n$\\vdots$\n$a_{n-1}$ $b_{n-1}$ $c_{n-1}$ $d_{n-1}$\n~~~\n\nInput Generation\n--------\nLet $rand()$ be a function that generates a uniformly random double-precision floating point number at least zero and less than one.\n\n#### Generation of $n$\nThe number of companies $n$ is generated by rounding $50 × 4^{rand()}$ to the nearest integer value.\n\n#### Generation of $x_i$ and $y_i$\nThe list of desired locations $(x_1,y_i),\\ldots,(x_n,y_n)$ is generated by randomly sampling $n$ distinct coordinates from $\\\\{(x, y) \\mid x\\in \\\\{0,1,\\ldots,9999\\\\}, y\\in\\\\{0,1,\\ldots,9999\\\\}\\\\}$.\n\n#### Generation of $r_i$\nLet $q_1,\\ldots,q_{n-1}$ be a sorted list of $n-1$ distinct integers randomly sampled from $\\\\{1,2,\\ldots,99999999\\\\}$.\nLet $q_0=0$ and $q_n=100000000$.\nThen $r_i=q_{i+1}-q_i$.\n\n\nNumber of test cases\n--------\n- Provisional test: 50\n- System test: 1000. We will publish seeds.txt (md5=8fc1ce3f4beabac6abc1bdb4206d7f7e) after the contest is over.\n\nThe score of a submission is the total scores for each test case.\nIn the provisional test, if your submission produces illegal output or exceeds the time limit for some test cases, the submission itself will be judged as WA or TLE, and the score of the submission will be zero.\nIn the system test, if your submission produces illegal output or exceeds the time limit for some test cases, only the score for those test cases will be zero.\n\nTools\n--------\nYou can download an input generator and visualizer <a href=\"https://img.atcoder.jp/ahc001/ded8fd3366b4ff0b0d7d053f553cdb84.zip\">here</a>.\nTo use them, you need a compilation environment of <a href=\"https://www.rust-lang.org/ja\">Rust language</a>.\n\n{sample example}\n", "config": "\ntype: default\nchecker: chk.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 100\n "}
|
| 39 |
{"problem_id": "148", "category": "algorithmic", "statement": "Problem Statement\n--------\nThere is a floor consisting of $50\\times 50$ squares.\nThe floor is covered with rectangular tiles without any gaps.\nEach tile has a size of either $1\\times 1$, $1\\times 2$, or $2\\times 1$ squares.\nLet $(0, 0)$ denote the top-left square, and $(i, j)$ denote the square at the $i$-th row from the top and $j$-th column from the left.\nTakahashi starts from $(si, sj)$ and walks along a path satisfying the following conditions.\n\n- From $(i, j)$, he can move to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, or $(i,j+1)$ in one step.\n- He can step on the same tile only once. The tile at the initial position is assumed to have already been stepped on.\n\nEach square has an integer value, and the score of a path is the sum of the values of the visited squares, including the square at the initial position.\nYour goal is to find a path with as high a score as possible.\n\nExamples\n--------\n<img src=\"./images/out1.svg\" width=200>\n<img src=\"./images/out2.svg\" width=200>\n<img src=\"./images/out3.svg\" width=200>\n\nOf the above three figures, only the path in the left figure satisfies the conditions.\nIn the middle figure, the same tile is stepped on twice in a row.\nIn the right figure, he left a tile once and then came back to the same tile.\n\n<img src=\"./images/out.min.svg\" width=1002>\n\nVisualization result of the sample output.\nThe red circle represents the initial position, and the green circle represents the final position.\nThe tiles stepped on are painted in light blue.\n\nScoring\n--------\nThe score of the output path is the score for the test case.\nIf the output does not satisfy the conditions, it is judged as `WA`.\nThere are 100 test cases, and the score of a submission is the total score for each test case.\nIf you get a result other than `AC` for one or more test cases, the score of the submission will be zero.\nThe highest score obtained during the contest time will determine the final ranking, and there will be no system test after the contest.\nIf more than one participant gets the same score, the ranking will be determined by the submission time of the submission that received that score.\n\n\nInput\n--------\nInput is given from Standard Input in the following format:\n\n~~~\n$si$ $sj$\n$t_{0,0}$ $t_{0,1}$ $\\ldots$ $t_{0,49}$\n$\\vdots$\n$t_{49,0}$ $t_{49,1}$ $\\ldots$ $t_{49,49}$\n$p_{0,0}$ $p_{0,1}$ $\\ldots$ $p_{0,49}$\n$\\vdots$\n$p_{49,0}$ $p_{49,1}$ $\\ldots$ $p_{49,49}$\n~~~\n\n- $(si,sj)$ denotes the initial position and satisfies $0\\leq si,sj\\leq 49$.\n- $t_{i,j}$ is an integer representing the tile placed on $(i,j)$. $(i,j)$ and $(i',j')$ are covered by the same tile if and only if $t_{i,j}=t_{i',j'}$ holds. Let the total number of tiles be $M$, then $0\\leq t_{i,j}\\leq M-1$ is satisfied.\n- $p_{i,j}$ is an integer value satisfying $0\\leq p_{i,j}\\leq 99$ which represents the score obtained when visiting $(i,j)$.\n\nOutput\n--------\nLet `U`, `D`, `L`, and `R` represent the movement from $(i,j)$ to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, and $(i,j+1)$, respectively.\nOutput a string representing a path in one line.\n\nInput Generation\n--------\n#### Generation of $si,sj$\nGenerate an integer between $0$ and $49$ uniformly at random.\n\n#### Generation of $t_{i,j}$\nWe start from an initial configuration where tiles of size $1\\times 1$ are placed on all squares.\nWe shuffle the 50x50 squares in random order and perform the following process for each square in order.\n\n- If the tile placed on the current square is $1\\times 1$, we randomly select one of the adjacent squares whose tile is $1\\times 1$ and connect the two tiles into one tile. If there are no such adjacent squares, we do nothing.\n- If the tile placed on the current square is not $1\\times 1$, we do nothing.\n\n#### Generation of $p_{i,j}$\nGenerate an integer between $0$ and $99$ uniformly at random independently for each square.\n\nTools\n--------\n- <a href=\"https://img.atcoder.jp/ahc002/8c847d8177acc2dd417be4327252e39e.zip\">Inputs</a>: A set of 100 inputs (seed 0-99) for local testing, including the sample input (seed 0). These inputs are different from the actual test case.\n- <a href=\"https://img.atcoder.jp/ahc002/e5b2b399792299b5b35543c219e89601.html\">Visualizer on the web</a>\n- <a href=\"https://img.atcoder.jp/ahc002/c993bb7f09d9f8857fc90951fc6af11d.zip\">Input generator and visualizer</a>: If you want to use more inputs, or if you want to visualize your output locally, you can use this program. You need a compilation environment of <a href=\"https://www.rust-lang.org/ja\">Rust language</a>.\n\n{sample example}\n", "config": "\ntype: default\nchecker: chk.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 100\n "}
|
| 40 |
{"problem_id": "149", "category": "algorithmic", "statement": "Story\n--------\nAtCoder is developing a route navigation application that utilizes shortest path algorithms.\nThe service area is represented as a road network of 30x30 vertices connected in a grid.\nWhen a user specifies the vertex of the current location and the vertex of the destination, the app will output the shortest path between them.\nThe trouble is that, even though the scheduled release date is approaching, the measurement of the length of each edge, which is essential for shortest path computations, is not finished at all.\nTherefore, AtCoder decided to give up measuring the edge length in advance and allows the app to output paths that are not the shortest.\nIt should be possible to gradually improve the performance by estimating the length of each edge based on the information about the actual time users take to arrive at their destinations.\n\nProblem Statement\n--------\nThere is an undirected grid graph with 30x30 vertices with unknown edge lengths.\nLet $(0, 0)$ denote the top-left vertex, and $(i, j)$ denote the vertex at the $i$-th row from the top and $j$-th column from the left.\nYour task is to process the following query 1000 times.\n\nIn the $k$-th query, your program first receives the vertices $s_k=(si_k,sj_k)$ and $t_k=(ti_k,tj_k)$ from Standard Input in the following format:\n\n~~~\n$si_k$ $sj_k$ $ti_k$ $tj_k$\n~~~\n\nThen, your program should compute a path $P_k$ from $s_k$ to $t_k$.\nLet `U`, `D`, `L`, and `R` represent the movement from $(i,j)$ to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, and $(i,j+1)$, respectively.\nOutput a string representing the path $P_k$ to Standard Output in one line.\n**After the output, you have to flush Standard Output.** Otherwise, the submission might be judged as TLE.\n\nAfter your program outputs a path, the judge program calculates the length $b_k$ of the path, generates a uniform random number $e_k$ between $0.9$ and $1.1$, and gives an integer value $\\mathrm{round}(b_k\\times e_k)$ to Standard Input.\nBy reading that integer, the $k$-th query completes, and you should proceed to the $k+1$-th query.\n\n\nExamples\n-----------------\n\n<table class=\"table table-bordered\">\n<thead>\n<tr>\n<th align=\"left\">Input</th>\n<th align=\"left\">Output</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\"><pre>3 19 16 17</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"></td>\n<td align=\"left\"><pre>DDDDDDDDDDDDDLL</pre></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>99561</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>26 18 13 18</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"></td>\n<td align=\"left\"><pre>UUUUUUUUUUUUU</pre></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>72947</pre></td>\n<td align=\"left\"></td>\n</tr>\n</tbody>\n</table>\n\n\nScoring\n--------\nLet $a_k$ and $b_k$ be the lengths of the shortest path and the output path for the $k$-th query ($1\\leq k\\leq 1000$), respectively.\nThen the score for the test case is\n\n$\\mathrm{round}(2312311\\times \\sum_{k=1}^{1000}0.998^{1000-k} \\frac{a_k}{b_k})$\n\nThe score of a submission is the total score for each test case.\nIf your program outputs an illegal path (visiting the same vertex multiple times, going outside of 30x30, or not a path from $s$ to $t$), it is judged as `WA`.\nAfter the contest is over, the final ranking will be determined by system tests against the last submission.\n\n- Provisional tests consist of 100 test cases. If you get a result other than `AC` for one or more test cases, the score of the submission will be zero.\n- System tests consist of 3000 test cases. If you get a result other than `AC` for some test cases, only the score for those test cases will be zero. We will publish seeds.txt (md5=0cf5051d586e7f62c0b3527f6f7fbb1c) after the contest is over.\n\n\n\nInput Generation\n--------\nLet $\\mathrm{rand}(L,U)$ be a function that generates a uniformly random integer between $L$ and $U$, inclusive.\nWe first generate two parameters $D=\\mathrm{rand}(100, 2000)$ and $M=\\mathrm{rand}(1, 2)$.\nLet $h_{i,j}$ be the length of the edge between $(i, j)$ and $(i,j+1)$, and let $v_{i,j}$ be the length of the edge between $(i, j)$ and $(i+1,j)$.\n\n#### Generation of $h_{i,j}$\n1. For each $i\\in\\\\{0,\\ldots,29\\\\}$ and $p\\in\\\\{0,\\ldots,M-1\\\\}$, we independently generate a random integer $H_{i,p}=\\mathrm{rand}(1000+D,9000-D)$.\n2. For each $i\\in\\\\{0,\\ldots,29\\\\}$ and $j\\in\\\\{0,\\ldots,28\\\\}$, we independently generate a random integer $\\delta_{i,j}=\\mathrm{rand}(-D,D)$.\n3. If $M=1$, for each $i\\in\\\\{0,\\ldots,29\\\\}$ and $j\\in\\\\{0,\\ldots,28\\\\}$, we set $h_{i,j}=H_{i,0}+\\delta_{i,j}$.\n4. If $M=2$, for each $i\\in\\\\{0,\\ldots,29\\\\}$, we generate a random integer $x_i=\\mathrm{rand}(1,28)$, and then for each $j\\in\\\\{0,\\ldots,x_i-1\\\\}$, we set $h_{i,j}=H_{i,0}+\\delta_{i,j}$, and for each $j\\in\\\\{x_i,\\ldots,28\\\\}$, we set $h_{i,j}=H_{i,1}+\\delta_{i,j}$.\n\n#### Generation of $v_{i,j}$\n1. For each $j\\in\\\\{0,\\ldots,29\\\\}$ and $p\\in\\\\{0,\\ldots,M-1\\\\}$, we independently generate a random integer $V_{j,p}=\\mathrm{rand}(1000+D,9000-D)$.\n2. For each $i\\in\\\\{0,\\ldots,28\\\\}$ and $j\\in\\\\{0,\\ldots,29\\\\}$, we independently generate a random integer $\\gamma_{i,j}=\\mathrm{rand}(-D,D)$.\n3. If $M=1$, for each $j\\in\\\\{0,\\ldots,29\\\\}$ and $i\\in\\\\{0,\\ldots,28\\\\}$, we set $v_{i,j}=V_{j,0}+\\gamma_{i,j}$.\n4. If $M=2$, for each $j\\in\\\\{0,\\ldots,29\\\\}$, we generate a random integer $y_j=\\mathrm{rand}(1,28)$, and then for each $i\\in\\\\{0,\\ldots,y_j-1\\\\}$, we set $v_{i,j}=V_{j,0}+\\gamma_{i,j}$, and for each $i\\in\\\\{y_j,\\ldots,28\\\\}$, we set $v_{i,j}=V_{j,1}+\\gamma_{i,j}$.\n\n#### Generation of $s_k$, $t_k$\nThe vertices $s_k$ and $t_k$ given in the query are chosen uniformly at random among all the vertices.\nIf the Manhattan distance between $s_k$ and $t_k$ ($|si_k-ti_k|+|sj_k-tj_k|$) is strictly less than 10, we repeat the random selection until the distance becomes at least 10.\n\n\n\nTools\n--------\n- <a href=\"https://img.atcoder.jp/ahc003/c1ae4a8996958aa31f5f9d3aa3f51033.zip\">Local tester</a>: You need a compilation environment of <a href=\"https://www.rust-lang.org/\">Rust language</a>.\n- <a href=\"https://img.atcoder.jp/ahc003/e7eb814463364c249c93216eee64275.html\">Visualizer</a>\n- <a href=\"https://img.atcoder.jp/ahc003/499df4d8fb8c9326c7b718917d14f17a.zip\">Inputs</a>: If you don't use the above local tester, you can instead use these 100 inputs (seed 0-99) for local testing. These inputs are different from the actual test cases. The inputs are in the following format, and you can use them by writing a judge program by yourself.\n\n~~~\n$h_{0,0}$ $\\ldots$ $h_{0,28}$\n$\\vdots$\n$h_{29,0}$ $\\ldots$ $h_{29,28}$\n$v_{0,0}$ $\\ldots$ $v_{0,29}$\n$\\vdots$\n$v_{28,0}$ $\\ldots$ $v_{28,29}$\n$si_1$ $sj_1$ $ti_1$ $tj_1$ $a_1$ $e_1$\n$\\vdots$\n$si_{1000}$ $sj_{1000}$ $ti_{1000}$ $tj_{1000}$ $a_{1000}$ $e_{1000}$\n~~~\n\n#### Example of judge program (pseudo code)\n~~~\nstring query(s, t, prev_result) {\n\t// WRITE YOUR SOLUTION HERE\n}\n\nint main() {\n\tif (LOCAL_TEST) {\n\t\tread_h_v();\n\t}\n\tprev_result = 0;\n\tscore = 0.0;\n\tfor (int k = 0; k < 1000; k++) {\n\t\tif (LOCAL_TEST) {\n\t\t\tread_s_t_a_e();\n\t\t} else {\n\t\t\tread_s_t();\n\t\t}\n\t\tpath = query(s, t, prev_result);\n\t\tprint(path);\n\t\tif (LOCAL_TEST) {\n\t\t\tb = compute_path_length(path);\n\t\t\tscore = score * 0.998 + a / b;\n\t\t\tprev_result = round(b * e);\n\t\t} else {\n\t\t\tprev_result = read_result();\n\t\t}\n\t}\n\tif (LOCAL_TEST) {\n\t\tprint(round(2312311 * score));\n\t}\n\treturn 0;\n}\n~~~\n", "config": "\ntype: interactive\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 75\n \n"}
|
|
@@ -256,7 +256,7 @@
|
|
| 256 |
{"problem_id": "bboplace_direct_ispd2005", "category": "2.0", "statement": "BBOPlace Direct ISPD2005\n=======================\n\nDirectly submit one JSON macro placement for a single BBOPlace ISPD2005 design:\n`adaptec1`. The hidden judge evaluates the placement with the original\nBBOPlace-Bench MGO MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour final submission is a JSON file at `/app/solution.json`. You are encouraged\nto write Python programs, shell scripts, search loops, local parsers, or any\nother helper code in `/app` while working. Those programs may generate and\noverwrite `/app/solution.json` many times. Only the final JSON artifact is\ngraded.\n\nThe agent container provides:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available for local helper scripts\n- hidden benchmark data is not available in the agent workspace\n\nThe judge also runs on CPU only. Do not rely on CUDA, DREAMPlace, Ray, or GPU\nplacement libraries for scoring.\n\nSubmission format\n-----------------\n\nSubmit exactly one placement for `adaptec1` by writing `/app/solution.json`.\nAfter your program writes the file, call `bash /app/submit.sh` to score that\nJSON. The JSON must use one of these forms:\n\n```json\n{\"placement\": [0.0, 0.0, \"...\"]}\n```\n\nor:\n\n```json\n{\"x\": [0.0, 0.0, \"...\"], \"y\": [0.0, 0.0, \"...\"]}\n```\n\nThe placement vector length must equal `dim = 2 * node_cnt`. The first\n`node_cnt` entries are x-grid coordinates and the remaining `node_cnt` entries\nare y-grid coordinates. Coordinates must be finite, with x in `[0, n_grid_x]`\nand y in `[0, n_grid_y]`. Only one placement is accepted.\n\nThe judge discloses public metadata through the iterative feedback path,\nincluding `dim`, `node_cnt`, `n_grid_x`, `n_grid_y`, and the baseline HPWL.\nThe netlist and evaluator source stay hidden in the judge image.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL for `adaptec1`:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe baseline constant is from the BBOPlace-Bench report, Table III,\n`MGO + Vanilla-EA` MP-HPWL. The paper reports values in units of `x10^5`; the\njudge stores the raw HPWL value relaxed by `1.2x`:\n\n- `adaptec1`: `6.96e5`\n\nBoth iterative submissions and final verification evaluate this same single\ndesign. The submit helper may still save the best iterative JSON artifact and\nrerun it during final verification.\n", "config": "tag: optimization\nruntime:\n language: json\n timeout_seconds: 10800\n environment: \"JSON placement for one hidden ISPD2005 BBOPlace design\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nsubmission:\n kind: file\n path: /app/solution.json\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 257 |
{"problem_id": "bboplace_iccad2015", "category": "2.0", "statement": "BBOPlace ICCAD2015\n==================\n\nWrite a Python solution that proposes macro placements for the BBOPlace MGO\nformulation on the ICCAD2015 benchmark suite. The hidden judge evaluates your\nplacements with the original BBOPlace-Bench MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour solution runs in the main agent container with:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available\n- internet access may be available during the trial, but the benchmark data is\n hidden and is not available in the agent workspace\n\nThe final verifier timeout is 10800 seconds. The judge also runs on CPU only.\nDo not rely on CUDA, DREAMPlace, Ray, or GPU placement libraries for scoring;\nthe official metric path used here is MGO with MP-HPWL.\n\nYour file must define one of:\n\n- `solve(info)`\n- `generate(info)`\n- `run(info)`\n- `CANDIDATES`, `CANDIDATE`, or `PLACEMENT`\n\nThe recommended interface is `solve(info)`. The judge calls it once per\nbenchmark. `info` contains:\n\n- `benchmark`: one of `superblue1`, `superblue3`, `superblue4`, `superblue5`,\n `superblue7`, `superblue10`, `superblue16`, `superblue18`\n- `dim`: placement vector length\n- `node_cnt`: number of macros\n- `n_grid_x`, `n_grid_y`: MGO grid bounds\n- `max_candidates_per_submission`: 16\n- `baseline_hpwl`: the baseline HPWL used for scoring\n\nReturn either one placement vector of length `dim`, or a 2D list/array with up\nto 16 placement candidates. For MGO, the first `node_cnt` entries are x-grid\ncoordinates in `[0, n_grid_x]`, and the remaining `node_cnt` entries are y-grid\ncoordinates in `[0, n_grid_y]`.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL. For each benchmark:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe final score is the mean score over the eight ICCAD2015 benchmarks. The\nunbounded score is the mean raw score before the zero clip.\n\nDuring iterative agent submissions, `/app/submit.sh` gives quick feedback on\n`superblue1` only. The final verifier evaluates the full eight-benchmark suite.\nUse the quick feedback to debug general placement logic, not as the complete\nleaderboard score.\n\nThe submit helper saves the best quick-feedback artifact it has seen. During\nfinal verification, the verifier reruns both the current `/app/solution.py` and\nthat saved best iterative artifact on the full suite, then uses the better\nfull-suite score. A quick-feedback score is never used directly as the final\nreward.\n\nThe baseline constants are from the BBOPlace-Bench report, Table V,\n`MGO + PSO` MP-HPWL. The paper reports values in units of `x10^5`; the judge\nstores raw HPWL values relaxed by `1.2x`:\n\n- `superblue1`: `0.696e5`\n- `superblue3`: `1.824e5`\n- `superblue4`: `1.128e5`\n- `superblue5`: `4.512e5`\n- `superblue7`: `2.028e5`\n- `superblue10`: `0.648e5`\n- `superblue16`: `1.152e5`\n- `superblue18`: `0.576e5`\n\nThe benchmark data and evaluator source are only present in the judge image.\nThey are not available in the agent workspace.\n", "config": "tag: optimization\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python solution returning BBOPlace MGO placement candidates; hidden ICCAD2015 judge data\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 258 |
{"problem_id": "bboplace_ispd2005", "category": "2.0", "statement": "BBOPlace ISPD2005\n=================\n\nWrite a Python solution that proposes macro placements for the BBOPlace MGO\nformulation on the ISPD2005 benchmark suite. The hidden judge evaluates your\nplacements with the original BBOPlace-Bench MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour solution runs in the main agent container with:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available\n- internet access may be available during the trial, but the benchmark data is\n hidden and is not available in the agent workspace\n\nThe final verifier timeout is 10800 seconds. The judge also runs on CPU only.\nDo not rely on CUDA, DREAMPlace, Ray, or GPU placement libraries for scoring;\nthe official metric path used here is MGO with MP-HPWL.\n\nYour file must define one of:\n\n- `solve(info)`\n- `generate(info)`\n- `run(info)`\n- `CANDIDATES`, `CANDIDATE`, or `PLACEMENT`\n\nThe recommended interface is `solve(info)`. The judge calls it once per\nbenchmark. `info` contains:\n\n- `benchmark`: one of `adaptec1`, `adaptec2`, `adaptec3`, `adaptec4`,\n `bigblue1`, `bigblue3`\n- `dim`: placement vector length\n- `node_cnt`: number of macros\n- `n_grid_x`, `n_grid_y`: MGO grid bounds\n- `max_candidates_per_submission`: 16\n- `baseline_hpwl`: the baseline HPWL used for scoring\n\nReturn either one placement vector of length `dim`, or a 2D list/array with up\nto 16 placement candidates. For MGO, the first `node_cnt` entries are x-grid\ncoordinates in `[0, n_grid_x]`, and the remaining `node_cnt` entries are y-grid\ncoordinates in `[0, n_grid_y]`.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL. For each benchmark:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe final score is the mean score over the six ISPD2005 benchmarks. The\nunbounded score is the mean raw score before the zero clip.\n\nDuring iterative agent submissions, `/app/submit.sh` gives quick feedback on\n`adaptec1` only. The final verifier evaluates the full six-benchmark suite.\nUse the quick feedback to debug general placement logic, not as the complete\nleaderboard score.\n\nThe submit helper saves the best quick-feedback artifact it has seen. During\nfinal verification, the verifier reruns both the current `/app/solution.py` and\nthat saved best iterative artifact on the full suite, then uses the better\nfull-suite score. A quick-feedback score is never used directly as the final\nreward.\n\nThe baseline constants are from the BBOPlace-Bench report, Table III,\n`MGO + Vanilla-EA` MP-HPWL. The paper reports values in units of `x10^5`; the\njudge stores raw HPWL values relaxed by `1.2x`:\n\n- `adaptec1`: `6.96e5`\n- `adaptec2`: `73.752e5`\n- `adaptec3`: `67.356e5`\n- `adaptec4`: `68.148e5`\n- `bigblue1`: `2.76e5`\n- `bigblue3`: `62.88e5`\n\nThe benchmark data and evaluator source are only present in the judge image.\nThey are not available in the agent workspace.\n", "config": "tag: optimization\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python solution returning BBOPlace MGO placement candidates; hidden ISPD2005 judge data\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 259 |
-
{"problem_id": "duckdb_e2e_query_optimization", "category": "2.0", "statement": "# DuckDB E2E Query Optimization\n\n## Problem\n\nThis is an experimental systems task. You are given a pinned DuckDB checkout in\nthe Harbor workspace and may modify DuckDB itself. Your goal is to improve\nend-to-end TPC-H style analytical query performance while preserving the\ncorrectness and generality of DuckDB's SQL execution.\n\nThe intended optimization area is end-to-end analytical query optimization:\njoin ordering, predicate transfer, join-side filtering, cardinality robustness,\nand closely related optimizer/execution wiring. Strong submissions should\nimprove TPC-H geometric mean runtime without hard-coding TPC-H tables, queries,\nbenchmark paths, or judge details.\n\n## Workload\n\nThe public workload family is DuckDB's built-in TPC-H query set. The public\nscale factor is 1, and the experimental judge evaluates q1 through q22 with\nDuckDB's TPC-H extension, for example by generating data with `CALL dbgen(...)`\nand running queries through `PRAGMA tpch(n)`. DuckDB also exposes its TPC-H\nquery text through the extension in normal DuckDB development workflows.\n\nTreat those queries as a representative analytical workload, not as strings to\nrecognize. The judge may include additional non-public scale-factor groups, and\nit may vary query order, repetitions, and correctness coverage. Submissions\nshould implement general optimizer and execution improvements rather than\nTPC-H-specific special cases.\n\n## Submission\n\nThe submitted artifact is a patch file:\n\n```text\n/app/solution.patch\n```\n\nThe agent workspace is expected to contain a DuckDB checkout at:\n\n```text\n/app/duckdb\n```\n\nAfter modifying DuckDB, generate and submit a patch:\n\n```bash\nbash /app/make_submission.sh\nbash /app/submit.sh\n```\n\nSubmissions are asynchronous. For this task, submit an initial small, plausible\npatch as soon as it is generated, then continue local review or compilation\nwhile the judge works. A full local DuckDB build in the agent container can\nconsume most of the agent budget and is not required before the first\nsubmission; the judge builds the submitted patch from a clean prebuilt source\ntree with fixed resource settings.\n\nThe judge applies the patch to a clean pinned DuckDB source tree, builds DuckDB\nwith the TPC-H extension enabled, and times the evaluated TPC-H queries from\nthe judge side. Submitted binaries, build artifacts, generated benchmark files,\nand local timing logs are ignored.\n\n## Correctness\n\nCorrectness is a gate. Patched DuckDB must produce the same SQL results as\nvanilla DuckDB on the evaluated workload. Build failures, patch failures,\nincorrect query results, crashes, timeouts, and out-of-memory failures are\npenalized before performance is considered.\n\nThe experimental evaluator currently encodes the patch policy, timing\norchestration, and vanilla-vs-patched TPC-H result comparison inside the custom\njudge image.
|
| 260 |
{"problem_id": "erdos_demo", "category": "2.0", "statement": "# Erdos Unit Distance Demo\n\n## Problem\n\nPlace exactly `N = 10` distinct points in the Euclidean plane so that the\nnumber of point pairs at Euclidean distance exactly `1` is as large as possible.\n\nThis is a tiny, visually inspectable demo version of the planar unit distance\nproblem. If your construction naturally has a different common distance, scale\nthe coordinates before returning them.\n\n## Program Interface\n\nSubmit a Python file defining one of the following:\n\n```python\ndef solve(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\ndef generate_points(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\nPOINTS = [(0.0, 0.0), (1.0, 0.0), ...]\n```\n\nThe returned value must contain exactly 10 two-dimensional points. No stdin is\nused.\n\n## Validity Constraints\n\nA solution is valid if:\n\n1. It returns exactly 10 points.\n2. Every coordinate is a finite real number.\n3. No two points are closer than `1e-6`.\n\nThe objective is translation-invariant. Very large coordinates are allowed as\nlong as pairwise squared distances remain finite.\n\n## Objective\n\nFor all unordered point pairs, count those whose squared Euclidean distance is\nequal to `1` within a small floating-point tolerance. Let `M` be that count.\n\nMaximize `M`.\n\n## Scoring\n\nThe score is naturally scaled to `[0, 100)`, without clipping against a fixed\ntarget. Let:\n\n```text\nbaseline = N\nX = M\n```\n\nIf the point set is invalid, or if `X <= baseline`, the score is `0`. Otherwise:\n\n```text\nscore = 100 * (X - baseline) / X\n```\n\nThis makes the simple `N`-pair baseline worth `0`. With only 10 points, the\nproblem is intended as a quick sanity check and visual demo for agent workflows.\n", "config": "tag: geometry\nruntime:\n language: python\n timeout_seconds: 300\n environment: \"Python 3.11; no external packages required\"\n docker:\n image: ubuntu:24.04\n"}
|
| 261 |
{"problem_id": "erdos_unit_distance", "category": "2.0", "statement": "# Erdos Unit Distance\n\n## Problem\n\nPlace exactly `N = 65536` distinct points in the Euclidean plane so that the\nnumber of point pairs at Euclidean distance exactly `1` is as large as possible.\n\nThis is a finite, executable version of the planar unit distance problem:\ngiven `n` points, maximize the number of pairs at distance exactly `1`. If your\nconstruction naturally has a different common distance, scale the coordinates\nbefore returning them.\n\n## Program Interface\n\nSubmit a Python file defining one of the following:\n\n```python\ndef solve(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\ndef generate_points(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\nPOINTS = [(0.0, 0.0), (1.0, 0.0), ...]\n```\n\nThe returned value must contain exactly 65536 two-dimensional points. No stdin\nis used.\n\n## Validity Constraints\n\nA solution is valid if:\n\n1. It returns exactly 65536 points.\n2. Every coordinate is a finite real number.\n3. No two points are closer than `1e-3`.\n\nThe objective is translation-invariant. Very large coordinates are allowed as\nlong as pairwise squared distances remain finite.\n\n## Objective\n\nFor all unordered point pairs, count those whose squared Euclidean distance is\nequal to `1` within a strict floating-point tolerance. Let `M` be that count.\n\nMaximize `M`.\n\n## Scoring\n\nThe score is naturally scaled to `[0, 100)`, without clipping against a fixed\ntarget. Let:\n\n```text\nbaseline = N\nX = M\n```\n\nIf the point set is invalid, or if `X <= baseline`, the score is `0`. Otherwise\nthe raw score is:\n\n```text\nraw_score = 100 * (X - baseline) / X\n```\n\nThe reported score applies a cubic scale:\n\n```text\nscore = 100 * (raw_score / 100)^3\n```\n\nThis makes the simple `N`-pair baseline worth `0`, rewards every improvement\nabove the baseline, and keeps high-scoring constructions from saturating the\nbenchmark too quickly. The bounded and unbounded score fields both report this\ncubic-scaled score; evaluator messages also include `raw_score` for reference.\n", "config": "tag: geometry\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python 3.11; no external packages required\"\n docker:\n image: ubuntu:24.04\n"}
|
| 262 |
{"problem_id": "vector_db_ann", "category": "2.0", "statement": "# Vector DB ANN\n\n## Problem\n\nBuild a fast approximate nearest-neighbor vector search engine for a\nSIFT1M-scale benchmark.\n\nThe hidden benchmark contains exactly `1,000,000` base vectors with dimension\n`128`. Queries use the same dimension, distance is squared Euclidean distance,\nand each query asks for the top `10` nearest vector ids.\n\nYour objective is to maximize serving throughput while preserving search\nquality: submissions must reach `recall@10 >= 0.95`, and valid submissions are\nranked by an effective QPS that includes query time plus a small load/index-build\npenalty.\n\nThe Harbor agent container starts with a small Rust skeleton project in\n`/app`. You may use it, modify it, or replace it entirely. You may also use any\nRust crates, internal harness, data structures, and build layout you want, as\nlong as the final project satisfies the judge contract below.\n\nThe judge builds and runs your service with:\n\n```bash\ncargo build --release\nPORT=<port> cargo run --release --quiet\n```\n\nThe Harbor environment uses the Ubuntu `apt` Rust toolchain:\n\n```text\nrustc 1.75\ncargo 1.75\n```\n\nIf you add crates, choose versions compatible with this toolchain or pin\ntransitive dependencies accordingly.\n\nThe service and judge run with the task resource limits below. Design your\nparallel search and indexing strategy for this budget:\n\n```text\nvCPUs: 8\nmemory: 16 GiB\nquery concurrency: 8\ntimed queries per worker: 64\n```\n\nThe service must listen on `PORT` and implement these endpoints:\n\n```text\nPOST /insert\nPOST /bulk_insert\nPOST /search\n```\n\n`/bulk_insert` receives:\n\n```json\n{\"vectors\":[{\"id\":0,\"vector\":[0.1,0.2,...]}]}\n```\n\nand returns:\n\n```json\n{\"status\":\"ok\",\"inserted\":1}\n```\n\n`/search` receives:\n\n```json\n{\"vector\":[0.1,0.2,...],\"top_k\":10}\n```\n\nand returns:\n\n```json\n{\"results\":[{\"id\":0,\"distance\":0.0}]}\n```\n\n## Local Harness\n\nThe official evaluator uses hidden data and a black-box judge. You may call:\n\n```bash\nbash /app/submit.sh\n```\n\nat any time to submit the current `/app` project to the official judge and get\nscore feedback.\n\n## Validity\n\nA submission is valid if:\n\n1. It builds successfully with `cargo build --release`.\n2. `cargo run --release --quiet` starts the service and implements the required HTTP\n endpoints.\n3. Every returned id is in `[0, 1_000_000)`.\n4. Its `recall@10` is at least `0.95` against the hidden exact top-10 ground\n truth.\n\n## Scoring\n\nAt trial startup, the Harbor judge sidecar prepares the hidden benchmark and\nruns an exact-search reference HTTP service through the same `/bulk_insert`\nand `/search` client harnesses to produce ground-truth nearest neighbors and\nthe trial-local scoring baseline:\n\n```text\nbaseline_qps\nbaseline_effective_qps\nbaseline_load_seconds\n```\n\nInteractive submissions and the final verifier both score through this same\njudge sidecar, so the baseline and runtime environment are shared within a\ntrial while still letting different machines measure their own local baseline.\n\nEach submission is then timed independently. The load phase includes all\n`/bulk_insert` calls and any index construction performed by the service before\nqueries begin. The query phase uses 8 concurrent workers, each issuing 64\nqueries, and measures only `/search` throughput:\n\n```text\ncandidate_qps\ncandidate_load_seconds\n```\n\nThe reported `qps` is the raw query-only QPS. Scoring uses an effective QPS\nthat includes a small index-build/load penalty:\n\n```text\neffective_qps = Q / (query_seconds + 0.01 * load_seconds)\n```\n\nThe load phase has a default `900s` timeout. This keeps the benchmark focused\non serving performance while still making very expensive offline indexing pay a\nbounded, explicit cost.\n\nDuring evaluation, the load and query phases may stop early and return `0` once\nthe elapsed time plus the load penalty makes it impossible for the final\neffective QPS to beat the baseline. During load, this assumes a best-case query\ntime of zero.\n\nIf the submission is invalid, if `recall@10 < 0.95`, or if\n`candidate_effective_qps <= baseline_effective_qps`, the score is `0`.\nOtherwise:\n\n```text\nscore = 100 * (1 - sqrt(baseline_effective_qps) / sqrt(candidate_effective_qps))\n```\n\nThe bounded and unbounded score fields both report this score. Harbor JSON\nresults include the measured `qps`, `effective_qps`, `baseline_qps`,\n`baseline_effective_qps`, `recall_at_10`, load time, and runtime metrics under\nthe `metrics` field.\n", "config": "tag: systems\nruntime:\n language: rust\n timeout_seconds: 10800\n environment: \"Rust project; hidden ANN benchmark; Python/NumPy judge\"\n apt_packages:\n - build-essential\n - cargo\n - git\n - rustc\n judge_apt_packages:\n - build-essential\n - cargo\n - rustc\n - python3-pip\n - python3-numpy\n judge_pip_packages:\n - faiss-cpu\n docker:\n image: ubuntu:24.04\nenvironment:\n # If these resource limits change, also update the resource budget text in\n # readme and harbor/app/README.md so agents can design parallel algorithms\n # for the actual CPU and memory budget.\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\nevaluation:\n # The judge drives the search service with this many concurrent workers.\n # Keep this aligned with the CPU budget unless the task is intentionally\n # changed into a higher-concurrency service benchmark.\n query_concurrency: 8\n queries_per_worker: 64\nsubmission:\n kind: directory\n path: /app\n exclude:\n - target\n - .git\n - .frontier-cs\n"}
|
|
|
|
| 34 |
{"problem_id": "142", "category": "algorithmic", "statement": "Ball Game\n\nYou are given n+1 poles numbered from 1 to n+1. Initially, poles 1 through n each contain m balls stacked vertically, while pole n+1 is empty. There are n*m balls in total, with n different colors, where each color appears exactly m times.\n\nYour task is to rearrange the balls so that all balls of the same color are on the same pole. The final distribution of colors to poles does not matter, as long as each pole contains balls of at most one color.\n\nYou can perform operations to move balls between poles. In one operation, you can move the topmost ball from pole x to the top of pole y, subject to the following constraints:\n- Pole x must have at least one ball\n- Pole y must have at most m-1 balls\n\nYour goal is to minimize the number of operations needed. You must use at most 2,000,000 operations.\n\nInput\n\nThe first line contains two integers n and m (2 ≤ n ≤ 50, 2 ≤ m ≤ 400) — the number of colors and the number of balls of each color.\n\nThe next n lines each contain m integers. The i-th line describes the color of balls on pole i from bottom to top. (colors are numbered from 1 to n).\n\nOutput\n\nOn the first line, print a single integer k (0 ≤ k ≤ 2,000,000) — the number of operations in your solution.\n\nThe next k lines should each contain two integers x and y (1 ≤ x, y ≤ n+1, x ≠ y), indicating that you move the topmost ball from pole x to pole y.\n\nIt is guaranteed that a valid solution exists.\n\nScoring\n\nYou will be graded based on the number of operations you use.\nIn order to receive any points, you must use no more than 2,000,000 operations.\nAfter that, your answer will be compared to a reference solution ref_ops. Your final score will be calculated as the average of 100 * min((ref_ops + 1) / (your_ops + 1), 1) across all test cases.\n\nTime limit: 4 seconds\nMemory limit: 512 MB\n\nSample Input:\n2 3\n1 1 2\n2 1 2\n\nSample Output:\n6\n1 3\n2 3\n2 3\n3 1\n3 2\n3 2", "config": "type: default\ntime: 4s\nmemory: 512m\nchecker: chk.cc\nsubtasks:\n - score: 100\n n_cases: 10"}
|
| 35 |
{"problem_id": "143", "category": "algorithmic", "statement": "Problem: Texas Hold’em Training (Terminal I/O Interactive)\n\nTime limit: 10 seconds\nMemory limit: 512 MB\n\nOverview\nYou will write a program that plays a large number of very simplified heads-up Texas Hold’em hands against a fixed opponent policy. The judge runs the game and reveals exactly the information you are allowed to know. Your program must decide whether to CHECK, FOLD, or RAISE an integer number of chips each betting round to maximize your chip profit. Interaction is via standard input/output (stdin/stdout). You must flush after every line you print.\n\nCards, ranks, and hand comparison\n- Deck: 52 cards, 4 suits labeled 0,1,2,3. Each suit has 13 values labeled 1..13 corresponding to 2,3,4,5,6,7,8,9,T,J,Q,K,A (in strictly increasing order).\n- A 5-card hand type ranking (highest to lowest):\n 1) Straight flush (a straight with all five cards same suit)\n 2) Four of a kind\n 3) Full house (three of a kind + a pair)\n 4) Flush (five cards same suit)\n 5) Straight (five consecutive values; A-2-3-4-5 is valid and is the lowest straight; K-A-2-3-4 is not)\n 6) Three of a kind\n 7) Two pairs\n 8) One pair\n 9) High card\n- Comparing two hands:\n - If hand types differ, higher type wins.\n - If both are straights or straight flushes: compare by the straight’s rank. Ten-to-Ace (T-J-Q-K-A) is the highest; A-2-3-4-5 is the lowest.\n - Otherwise, sort the 5 cards by the tuple (multiplicity, value) in descending order, where multiplicity is how many times the value appears in the hand. Compare these 5-card sequences lexicographically. Suits never break ties beyond determining flush/straight flush.\n - Examples:\n - Same-suit 5-6-7-8-9 > same-suit A-2-3-4-5.\n - Same-suit A-2-3-4-5 > same-suit 2-4-5-6-7 (the latter is not a straight).\n - 3-3-8-8-K > 5-5-7-7-A (two pairs with higher top pair/tiebreakers).\n - Q-Q-Q-T-T > J-J-J-A-A.\n- Board-of-7 rule: At showdown each player forms their best 5-card hand from their 7 available cards (2 private + 5 community). The higher best 5-card hand wins; equal best hands tie.\n\nGame flow (per hand)\n- Shuffling and dealing:\n - The 52 cards are uniformly randomly permuted.\n - You (Alice) receive the top 2 cards; the opponent (Bob) receives the next 2 (unknown to you).\n - A “pot” starts with 10 chips. Both players start the hand with 100 chips behind (stacks). All chip counts are integers.\n- Four betting rounds, with at most one action from you and one response from Bob per round:\n 1) Round 1 (preflop): no community cards are visible.\n 2) Reveal 3 community cards (the flop).\n 3) Round 2.\n 4) Reveal 1 community card (the turn).\n 5) Round 3.\n 6) Reveal 1 community card (the river).\n 7) Round 4.\n- Your options when it is your turn in any round:\n - CHECK: no chips move.\n - FOLD: the hand ends immediately; Bob wins the entire pot.\n - RAISE x: choose an integer x with 1 ≤ x ≤ your current stack; you move x chips into the pot.\n- Bob’s response after your action:\n - If you CHECK: Bob always CHECKS (no bet this round).\n - If you RAISE x: Bob either FOLDs (you win the pot immediately) or CALLs (she moves x chips into the pot).\n - It is guaranteed Bob always has enough chips to call any allowed raise x (by construction of this single-raise-per-round process).\n- Showdown and payouts:\n - If nobody folds by the end of Round 4, reveal all community cards (already visible) and both hole cards are implicitly known to the judge; the judge determines the winner using the rules above.\n - Winner gets the entire pot; if tie, the pot is split evenly (integer arithmetic; pot is always even here).\n - Your profit for the hand is (your ending stack) − 100. Positive means you won chips; negative means you lost chips.\n\nOpponent policy (Bob)\n- If you CHECK, she CHECKs.\n- If you RAISE x, she compares:\n - EV(FOLD) = (her current stack) − 100.\n - EV(CALL) = estimated via 100 Monte Carlo rollouts:\n - Consider all yet-unseen cards (your hole cards are hidden from Bob, and unrevealed community cards are unknown).\n - For each rollout: take a uniform random permutation of the remaining unseen cards; assign them to all unknown positions in natural order (your hidden cards remain unknown to Bob but are assigned in the simulation; remaining community cards are dealt next).\n - Assume that after she calls now, you will CHECK in all future rounds (this is how she evaluates the call).\n - Compute her resulting profit in that simulation.\n - EV(CALL) is the average over the 100 rollouts.\n - She CALLs if and only if EV(CALL) > EV(FOLD); otherwise she FOLDs.\n\nTerminal I/O protocol\nAll lines are plain ASCII tokens separated by spaces. You must flush after every line you print. If you ever read -1, you must exit immediately.\n\nStart of the match\n- Read a single integer G: the number of hands the judge will play (up to 10,000 in official tests).\n\nPer-hand loop\nThe judge will drive the hand by repeatedly sending a STATE describing your next decision point. After a STATE, you may ask for Monte Carlo equity estimates, then you must output exactly one ACTION.\n\nState description (from judge to you)\n- STATE h r a b P k\n - h: 1-based hand index\n - r: current round in {1,2,3,4} (you act first in each round)\n - a: your current stack (chips behind)\n - b: Bob’s current stack\n - P: current pot size\n - k: number of currently revealed community cards; k ∈ {0,3,4,5}\n- ALICE c1 v1 c2 v2\n - Your two hole cards as (suit, value) pairs; suit in [0..3], value in [1..13] for 2..A\n- BOARD followed by 2k integers\n - Exactly k cards, each as (suit, value); if k = 0, the line is just “BOARD” with no numbers.\n\nOptional helper query (from you to judge)\n- RATE t\n - t: positive integer number of sampling rollouts the judge should use to estimate your win/draw rates from the current partial state (this mimics getRatesBySampling). The judge responds:\n - RATES w d\n - w: estimated probability that your final 7-card hand will be strictly better than Bob’s (double)\n - d: estimated probability of a tie (double)\n - The sampling completes the currently unknown cards (Bob’s hole, unrevealed community) uniformly at random from the remaining deck.\n - Global budget: sum of all t over the entire match must be ≤ 3,000,000. If you exceed this, the judge may reply with -1 and terminate. RATE does not advance the hand; you may issue multiple RATE queries per STATE within the budget.\n\nYour decision (exactly one per STATE)\n- ACTION CHECK\n- ACTION FOLD\n- ACTION RAISE x\n - x must be an integer with 1 ≤ x ≤ your current stack a.\n\nJudge’s immediate response after your ACTION\n- If ACTION CHECK:\n - OPP CHECK\n - If r < 4, dealing proceeds and you will receive the next STATE for round r+1 (with updated k = 3,4,5).\n - If r = 4, the hand ends by showdown; judge then prints RESULT delta.\n- If ACTION RAISE x:\n - OPP FOLD\n - The hand ends immediately; judge prints RESULT delta (your profit for this hand).\n - or OPP CALL x\n - The hand continues. If r < 4, the judge proceeds to the next STATE (round r+1 with more community cards). If r = 4, the hand ends by showdown and judge prints RESULT delta.\n- RESULT delta\n - delta is your integer profit for this hand: ending stack − 100. The next hand then begins (or the match ends if h = G).\n\nEnd of the match\n- After all G hands, the judge prints:\n - SCORE W\n - W is your average profit per hand (double), i.e., mean of all delta.\n\nValidity and termination\n- Any malformed command, out-of-range raise, or protocol violation may cause the judge to print -1 and terminate immediately; your program must exit upon reading -1.\n- Always flush after printing RATE or ACTION (e.g., in C++: cout << line << endl; or fflush(stdout)).\n\nConstraints and guarantees\n- G ≤ 10,000 in official tests.\n- Sum of t over all RATE queries ≤ 3,000,000.\n- All chip movements are integers. Pot and stacks fit in 32-bit signed integers in all official tests.\n- The hidden deck for each hand is fixed before the hand begins and does not depend on your queries.\n- With this single-raise-per-round structure and symmetric stacks, Bob always has enough chips to CALL any legal RAISE you declare.\n\nScoring\nOnly programs that follow the protocol, do not exceed the RATE budget, and finish all hands are scored.\n\nLet W be the final average profit per hand printed by the judge (the SCORE value). Your points are a piecewise-linear function of W:\n\n- If W ≤ 8.0: score = 0.\n- If 8.0 < W ≤ 11.0: score increases linearly from 0 to 40:\n score = round(13.3 × (W − 8)).\n- If 11.0 < W ≤ 14.0: score increases linearly from 40 to 82:\n score = 40 + round(14 × (W − 11)).\n- If 14.0 < W: score increases linearly from 82 to Infinite:\n score = 82 + round(3 × (W − 14)).\n\n\nInterpretation:\n- Around W ≥ 11 indicates you beat a simple baseline (roughly “Small Task”).\n- Around W ≥ 16 indicates a strong strategy (roughly “Large Task”).\n\nExample interaction (illustrative only)\nJudge: 1\nJudge: STATE 1 1 100 100 10 0\nJudge: ALICE 0 12 2 1\nJudge: BOARD\nYou: RATE 100\nJudge: RATES 0.421000 0.010000\nYou: ACTION RAISE 5\nJudge: OPP FOLD\nJudge: RESULT 15\nJudge: SCORE 15.000000\n\nNotes and clarifications\n- Card encoding:\n - Each card is printed as two integers: suit in [0..3], value in [1..13] corresponding to 2..A.\n - Community cards appear in deal order on BOARD (first the 3-card flop, then turn, then river).\n- You do not need to implement hand evaluation to be correct; the judge handles showdowns. However, to plan your actions you may use RATE queries (within budget) or implement your own simulation/evaluation.\n- Precision of RATES and SCORE is implementation-defined by the judge; treat them as doubles. Do not rely on a fixed number of decimals.\n- If you ever read -1, exit immediately without printing anything further.\n\nStrategy discussion (non-binding)\n- The opponent’s CALL decision underestimates your future aggression (she assumes you will CHECK afterwards), which can be exploited by well-timed raises.\n- RATE queries give you (win, tie) probabilities under random completions; combined with current pot and effective stacks, you can estimate immediate fold equity versus call equity to choose raise sizes.\n- Budget your RATE calls: preflop and early-street coarse estimates (small t) and larger t near pivotal decisions can perform well within the 3,000,000 budget.\n", "config": "# Set the problem type to interactive\ntype: interactive\n\n# Specify the interactor source file\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 100s\nmemory: 512m\n\n# The subtasks section works the same way\nsubtasks:\n - score: 100\n n_cases: 10 # Looks for 1.in, 2.in, ... 5.in"}
|
| 36 |
{"problem_id": "144", "category": "algorithmic", "statement": "Find Median\n\nThis is an interactive problem.\n\nThere is a hidden permutation p of length n, where n is even.\nYou are allowed to make queries by choosing a subsequence of indices with even length k (where 4 ≤ k ≤ n). For a chosen subsequence, the interactor will return the two median values.\nFor a subsequence of even length k, the two medians are defined as the k/2-th and (k/2+1)-th smallest values in that subsequence.\n\nYour goal is to find the index of the two medians in permutation p. This problem is graded based on the number of queries you use. In order to receive any points, you must use no more than 500 queries. After that, your answer will be compared to a solution ref_queries. Your final score will be calculated as the average of 100 * min(ref_queries / your_queries, 1) across all cases.\n\nInput\n\nThe first line contains a single integer n (6 ≤ n ≤ 100, n is even) — the length of the hidden permutation.\n\nInteraction\n\nTo make a query, output one line in the following format:\n0 k x1 x2 ... xk\n\nwhere:\n- k is the length of the subsequence (4 ≤ k ≤ n, k must be even)\n- x1, x2, ..., xk are distinct indices between 1 and n\n\nAfter each query, read a line containing two integers m1 and m2 (1 ≤ m1 < m2 ≤ n) — the two median values of the subsequence.\n\nWhen you have found the answer, output one line in the following format:\n1 i1 i2 - the index of the two medians.\n\nAfter printing the answer, your program should terminate immediately.\n\nNote: The interactor is non-adaptive. The permutation is fixed before you start querying.\n\nTo flush your output, use:\n- fflush(stdout) or cout.flush() in C++\n- System.out.flush() in Java\n- stdout.flush() in Python\n\nExample Interaction\n\nInput:\n6\n\n3 4\n\n3 4\n\n2 3\n\nOutput:\n\n0 6 1 2 3 4 5 6\n\n0 4 3 6 1 5\n\n0 4 3 6 2 5\n\n1 3 6\n\nTime limit: 4 seconds\nMemory limit: 512 MB", "config": "type: interactive\ninteractor: interactor.cc\ntime: 4s\nmemory: 512m\nsubtasks:\n - score: 100\n n_cases: 10"}
|
| 37 |
+
{"problem_id": "145", "category": "algorithmic", "statement": "# Number Loop Construction\n\nYou are given a fixed 12 by 12 clue template. Some cells are clue cells, and the\nremaining cells are blank. Your task is to fill every clue cell with a digit and\nconstruct a Number Loop puzzle.\n\nThe goal has two levels:\n\n1. Make the puzzle have as few valid loop solutions as possible.\n2. Among puzzles with the same number of valid loop solutions, maximize the\n number of clue cells equal to `1`.\n\n## Number Loop Rules\n\nA loop is drawn on the grid lines around the 12 by 12 cells.\n\n* Each grid vertex must have degree either `0` or `2`.\n* The selected grid edges must form exactly one non-empty closed loop.\n* For every clue cell containing digit `d`, exactly `d` of its four surrounding\n grid edges must be selected.\n* Blank cells impose no clue constraint.\n\nA valid loop solution is one loop satisfying all clue constraints in your\noutput puzzle.\n\n## Template\n\nYour output must preserve the following blank positions exactly. Every `?`\nposition must be replaced by a digit.\n\n```text\n? ? ??? \n?? ?? ? ?\n? ? ? ? ?\n? ? ? ???? \n? ? ? ? \n? ? ? \n \n? ? ?????\n? ? ? \n?? ? ? ? \n? ? ? ? ? \n? ? ??? ? \n```\n\nThere are 56 clue cells.\n\n## Input Format\n\nThe input contains a single integer:\n\n* `0`: each clue cell may be one of `0`, `1`, `2`, or `3`.\n* `1`: each clue cell may be one of `1`, `2`, or `3`.\n\n## Output Format\n\nOutput exactly 12 lines, each with exactly 12 characters.\n\n* A blank position in the template must be output as a space.\n* A `?` position in the template must be output as an allowed digit.\n\nTrailing spaces are significant for the 12 by 12 format.\n\n## Scoring\n\nFor each test case, the judge counts the number of valid loop solutions in your\nconstructed puzzle, up to a cap of six solutions. It also counts\n\n```text\nones = number of clue cells equal to '1'\n```\n\nLet `u = ones / 56`.\n\nThe per-case score is:\n\n```text\n0 valid solutions: 0\n6 or more valid solutions: 1 + 9 * u\n5 valid solutions: 10 + 10 * u\n4 valid solutions: 20 + 10 * u\n3 valid solutions: 30 + 10 * u\n2 valid solutions: 40 + 10 * u\n1 valid solution: 50 + 50 * u\n```\n\nThe final score is the average over the two test cases. A unique-solution puzzle\nis therefore always better than any non-unique puzzle, and within the same\nsolution-count bucket, more `1` clues are better.\n\n## Sample Output\n\nThe following output only illustrates the required 12 by 12 format. It is not\nnecessarily a high-scoring construction.\n\n```text\n0 0 000 \n00 00 0 0\n0 0 0 0 0\n0 0 0 0000 \n0 0 0 0 \n0 0 0 \n \n0 0 00000\n0 0 0 \n00 0 0 0 \n0 0 0 0 0 \n0 0 000 0 \n```\n", "config": "type: default\n\ntime: 3s\nmemory: 1024m\n\nchecker: checker.cpp\ncheker_type: testlib\nsubtasks:\n - score: 100\n n_cases: 2"}
|
| 38 |
{"problem_id": "147", "category": "algorithmic", "statement": "Problem Statement\n--------\nAtCoder has decided to place web advertisements of $n$ companies on the top page.\nThe space for placing advertisements is a square of size 10000 x 10000.\nThe space for each company must be an axis-parallel rectangle with positive area, and the coordinates of the vertices must be integer values.\nDifferent rectangles may touch on their sides, but they must not overlap. In other words, the common area must not have positive area.\nIt is allowed to leave some free space that does not belong to any ad.\n\nPresident Takahashi asked each company for their desired location and area. Company $i$ wants an ad space with area $r_i$ including point $(x_i+0.5, y_i+0.5)$.\nThe satisfaction level $p_i$ of company $i$ is determined as follows.\n\n- If the ad space for company $i$ does not contain the point $(x_i+0.5, y_i+0.5)$, then $p_i = 0$.\n- If the ad space for company $i$ contains the point $(x_i+0.5, y_i+0.5)$ and the area is $s_i$, then $p_i = 1 - (1 - \\min(r_i,s_i) / \\max(r_i, s_i))^2$.\n\nYour task is to determine the placement of the ads so that the sum of the satisfaction levels is maximized.\nYou will get a score of $10^9 \\times \\sum_{i=0}^{n-1} p_i / n$ rounded to the nearest integer.\n\n\n\nInput\n--------\nInput is given from Standard Input in the following format:\n\n~~~\n$n$\n$x_0$ $y_0$ $r_0$\n$\\vdots$\n$x_{n-1}$ $y_{n-1}$ $r_{n-1}$\n~~~\n\n- $50\\leq n\\leq 200$\n- $x_i$ and $y_i$ are integers satisfying $0\\leq x_i\\leq 9999$ and $0\\leq y_i\\leq 9999$. For any $i\\neq j$, $(x_i,y_i)\\neq (x_j,y_j)$ holds.\n- $r_i$ is an integer at least one and satisfies $\\sum_{i=0}^{n-1} r_i=10000\\times 10000$.\n\nOutput\n--------\nLet $(a_i, b_i)$ and $(c_i, d_i)$ ($0\\leq a_i<c_i\\leq 10000$, $0\\leq b_i<d_i\\leq 10000$) be the coordinates of the two diagonal vertices of the rectangle representing the ad space for company $i$.\nOutput to standard output in the following format.\n\n~~~\n$a_0$ $b_0$ $c_0$ $d_0$\n$\\vdots$\n$a_{n-1}$ $b_{n-1}$ $c_{n-1}$ $d_{n-1}$\n~~~\n\nInput Generation\n--------\nLet $rand()$ be a function that generates a uniformly random double-precision floating point number at least zero and less than one.\n\n#### Generation of $n$\nThe number of companies $n$ is generated by rounding $50 × 4^{rand()}$ to the nearest integer value.\n\n#### Generation of $x_i$ and $y_i$\nThe list of desired locations $(x_1,y_i),\\ldots,(x_n,y_n)$ is generated by randomly sampling $n$ distinct coordinates from $\\\\{(x, y) \\mid x\\in \\\\{0,1,\\ldots,9999\\\\}, y\\in\\\\{0,1,\\ldots,9999\\\\}\\\\}$.\n\n#### Generation of $r_i$\nLet $q_1,\\ldots,q_{n-1}$ be a sorted list of $n-1$ distinct integers randomly sampled from $\\\\{1,2,\\ldots,99999999\\\\}$.\nLet $q_0=0$ and $q_n=100000000$.\nThen $r_i=q_{i+1}-q_i$.\n\n\nNumber of test cases\n--------\n- Provisional test: 50\n- System test: 1000. We will publish seeds.txt (md5=8fc1ce3f4beabac6abc1bdb4206d7f7e) after the contest is over.\n\nThe score of a submission is the total scores for each test case.\nIn the provisional test, if your submission produces illegal output or exceeds the time limit for some test cases, the submission itself will be judged as WA or TLE, and the score of the submission will be zero.\nIn the system test, if your submission produces illegal output or exceeds the time limit for some test cases, only the score for those test cases will be zero.\n\nTools\n--------\nYou can download an input generator and visualizer <a href=\"https://img.atcoder.jp/ahc001/ded8fd3366b4ff0b0d7d053f553cdb84.zip\">here</a>.\nTo use them, you need a compilation environment of <a href=\"https://www.rust-lang.org/ja\">Rust language</a>.\n\n{sample example}\n", "config": "\ntype: default\nchecker: chk.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 100\n "}
|
| 39 |
{"problem_id": "148", "category": "algorithmic", "statement": "Problem Statement\n--------\nThere is a floor consisting of $50\\times 50$ squares.\nThe floor is covered with rectangular tiles without any gaps.\nEach tile has a size of either $1\\times 1$, $1\\times 2$, or $2\\times 1$ squares.\nLet $(0, 0)$ denote the top-left square, and $(i, j)$ denote the square at the $i$-th row from the top and $j$-th column from the left.\nTakahashi starts from $(si, sj)$ and walks along a path satisfying the following conditions.\n\n- From $(i, j)$, he can move to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, or $(i,j+1)$ in one step.\n- He can step on the same tile only once. The tile at the initial position is assumed to have already been stepped on.\n\nEach square has an integer value, and the score of a path is the sum of the values of the visited squares, including the square at the initial position.\nYour goal is to find a path with as high a score as possible.\n\nExamples\n--------\n<img src=\"./images/out1.svg\" width=200>\n<img src=\"./images/out2.svg\" width=200>\n<img src=\"./images/out3.svg\" width=200>\n\nOf the above three figures, only the path in the left figure satisfies the conditions.\nIn the middle figure, the same tile is stepped on twice in a row.\nIn the right figure, he left a tile once and then came back to the same tile.\n\n<img src=\"./images/out.min.svg\" width=1002>\n\nVisualization result of the sample output.\nThe red circle represents the initial position, and the green circle represents the final position.\nThe tiles stepped on are painted in light blue.\n\nScoring\n--------\nThe score of the output path is the score for the test case.\nIf the output does not satisfy the conditions, it is judged as `WA`.\nThere are 100 test cases, and the score of a submission is the total score for each test case.\nIf you get a result other than `AC` for one or more test cases, the score of the submission will be zero.\nThe highest score obtained during the contest time will determine the final ranking, and there will be no system test after the contest.\nIf more than one participant gets the same score, the ranking will be determined by the submission time of the submission that received that score.\n\n\nInput\n--------\nInput is given from Standard Input in the following format:\n\n~~~\n$si$ $sj$\n$t_{0,0}$ $t_{0,1}$ $\\ldots$ $t_{0,49}$\n$\\vdots$\n$t_{49,0}$ $t_{49,1}$ $\\ldots$ $t_{49,49}$\n$p_{0,0}$ $p_{0,1}$ $\\ldots$ $p_{0,49}$\n$\\vdots$\n$p_{49,0}$ $p_{49,1}$ $\\ldots$ $p_{49,49}$\n~~~\n\n- $(si,sj)$ denotes the initial position and satisfies $0\\leq si,sj\\leq 49$.\n- $t_{i,j}$ is an integer representing the tile placed on $(i,j)$. $(i,j)$ and $(i',j')$ are covered by the same tile if and only if $t_{i,j}=t_{i',j'}$ holds. Let the total number of tiles be $M$, then $0\\leq t_{i,j}\\leq M-1$ is satisfied.\n- $p_{i,j}$ is an integer value satisfying $0\\leq p_{i,j}\\leq 99$ which represents the score obtained when visiting $(i,j)$.\n\nOutput\n--------\nLet `U`, `D`, `L`, and `R` represent the movement from $(i,j)$ to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, and $(i,j+1)$, respectively.\nOutput a string representing a path in one line.\n\nInput Generation\n--------\n#### Generation of $si,sj$\nGenerate an integer between $0$ and $49$ uniformly at random.\n\n#### Generation of $t_{i,j}$\nWe start from an initial configuration where tiles of size $1\\times 1$ are placed on all squares.\nWe shuffle the 50x50 squares in random order and perform the following process for each square in order.\n\n- If the tile placed on the current square is $1\\times 1$, we randomly select one of the adjacent squares whose tile is $1\\times 1$ and connect the two tiles into one tile. If there are no such adjacent squares, we do nothing.\n- If the tile placed on the current square is not $1\\times 1$, we do nothing.\n\n#### Generation of $p_{i,j}$\nGenerate an integer between $0$ and $99$ uniformly at random independently for each square.\n\nTools\n--------\n- <a href=\"https://img.atcoder.jp/ahc002/8c847d8177acc2dd417be4327252e39e.zip\">Inputs</a>: A set of 100 inputs (seed 0-99) for local testing, including the sample input (seed 0). These inputs are different from the actual test case.\n- <a href=\"https://img.atcoder.jp/ahc002/e5b2b399792299b5b35543c219e89601.html\">Visualizer on the web</a>\n- <a href=\"https://img.atcoder.jp/ahc002/c993bb7f09d9f8857fc90951fc6af11d.zip\">Input generator and visualizer</a>: If you want to use more inputs, or if you want to visualize your output locally, you can use this program. You need a compilation environment of <a href=\"https://www.rust-lang.org/ja\">Rust language</a>.\n\n{sample example}\n", "config": "\ntype: default\nchecker: chk.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 100\n "}
|
| 40 |
{"problem_id": "149", "category": "algorithmic", "statement": "Story\n--------\nAtCoder is developing a route navigation application that utilizes shortest path algorithms.\nThe service area is represented as a road network of 30x30 vertices connected in a grid.\nWhen a user specifies the vertex of the current location and the vertex of the destination, the app will output the shortest path between them.\nThe trouble is that, even though the scheduled release date is approaching, the measurement of the length of each edge, which is essential for shortest path computations, is not finished at all.\nTherefore, AtCoder decided to give up measuring the edge length in advance and allows the app to output paths that are not the shortest.\nIt should be possible to gradually improve the performance by estimating the length of each edge based on the information about the actual time users take to arrive at their destinations.\n\nProblem Statement\n--------\nThere is an undirected grid graph with 30x30 vertices with unknown edge lengths.\nLet $(0, 0)$ denote the top-left vertex, and $(i, j)$ denote the vertex at the $i$-th row from the top and $j$-th column from the left.\nYour task is to process the following query 1000 times.\n\nIn the $k$-th query, your program first receives the vertices $s_k=(si_k,sj_k)$ and $t_k=(ti_k,tj_k)$ from Standard Input in the following format:\n\n~~~\n$si_k$ $sj_k$ $ti_k$ $tj_k$\n~~~\n\nThen, your program should compute a path $P_k$ from $s_k$ to $t_k$.\nLet `U`, `D`, `L`, and `R` represent the movement from $(i,j)$ to $(i-1,j)$, $(i+1,j)$, $(i,j-1)$, and $(i,j+1)$, respectively.\nOutput a string representing the path $P_k$ to Standard Output in one line.\n**After the output, you have to flush Standard Output.** Otherwise, the submission might be judged as TLE.\n\nAfter your program outputs a path, the judge program calculates the length $b_k$ of the path, generates a uniform random number $e_k$ between $0.9$ and $1.1$, and gives an integer value $\\mathrm{round}(b_k\\times e_k)$ to Standard Input.\nBy reading that integer, the $k$-th query completes, and you should proceed to the $k+1$-th query.\n\n\nExamples\n-----------------\n\n<table class=\"table table-bordered\">\n<thead>\n<tr>\n<th align=\"left\">Input</th>\n<th align=\"left\">Output</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\"><pre>3 19 16 17</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"></td>\n<td align=\"left\"><pre>DDDDDDDDDDDDDLL</pre></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>99561</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>26 18 13 18</pre></td>\n<td align=\"left\"></td>\n</tr>\n<tr>\n<td align=\"left\"></td>\n<td align=\"left\"><pre>UUUUUUUUUUUUU</pre></td>\n</tr>\n<tr>\n<td align=\"left\"><pre>72947</pre></td>\n<td align=\"left\"></td>\n</tr>\n</tbody>\n</table>\n\n\nScoring\n--------\nLet $a_k$ and $b_k$ be the lengths of the shortest path and the output path for the $k$-th query ($1\\leq k\\leq 1000$), respectively.\nThen the score for the test case is\n\n$\\mathrm{round}(2312311\\times \\sum_{k=1}^{1000}0.998^{1000-k} \\frac{a_k}{b_k})$\n\nThe score of a submission is the total score for each test case.\nIf your program outputs an illegal path (visiting the same vertex multiple times, going outside of 30x30, or not a path from $s$ to $t$), it is judged as `WA`.\nAfter the contest is over, the final ranking will be determined by system tests against the last submission.\n\n- Provisional tests consist of 100 test cases. If you get a result other than `AC` for one or more test cases, the score of the submission will be zero.\n- System tests consist of 3000 test cases. If you get a result other than `AC` for some test cases, only the score for those test cases will be zero. We will publish seeds.txt (md5=0cf5051d586e7f62c0b3527f6f7fbb1c) after the contest is over.\n\n\n\nInput Generation\n--------\nLet $\\mathrm{rand}(L,U)$ be a function that generates a uniformly random integer between $L$ and $U$, inclusive.\nWe first generate two parameters $D=\\mathrm{rand}(100, 2000)$ and $M=\\mathrm{rand}(1, 2)$.\nLet $h_{i,j}$ be the length of the edge between $(i, j)$ and $(i,j+1)$, and let $v_{i,j}$ be the length of the edge between $(i, j)$ and $(i+1,j)$.\n\n#### Generation of $h_{i,j}$\n1. For each $i\\in\\\\{0,\\ldots,29\\\\}$ and $p\\in\\\\{0,\\ldots,M-1\\\\}$, we independently generate a random integer $H_{i,p}=\\mathrm{rand}(1000+D,9000-D)$.\n2. For each $i\\in\\\\{0,\\ldots,29\\\\}$ and $j\\in\\\\{0,\\ldots,28\\\\}$, we independently generate a random integer $\\delta_{i,j}=\\mathrm{rand}(-D,D)$.\n3. If $M=1$, for each $i\\in\\\\{0,\\ldots,29\\\\}$ and $j\\in\\\\{0,\\ldots,28\\\\}$, we set $h_{i,j}=H_{i,0}+\\delta_{i,j}$.\n4. If $M=2$, for each $i\\in\\\\{0,\\ldots,29\\\\}$, we generate a random integer $x_i=\\mathrm{rand}(1,28)$, and then for each $j\\in\\\\{0,\\ldots,x_i-1\\\\}$, we set $h_{i,j}=H_{i,0}+\\delta_{i,j}$, and for each $j\\in\\\\{x_i,\\ldots,28\\\\}$, we set $h_{i,j}=H_{i,1}+\\delta_{i,j}$.\n\n#### Generation of $v_{i,j}$\n1. For each $j\\in\\\\{0,\\ldots,29\\\\}$ and $p\\in\\\\{0,\\ldots,M-1\\\\}$, we independently generate a random integer $V_{j,p}=\\mathrm{rand}(1000+D,9000-D)$.\n2. For each $i\\in\\\\{0,\\ldots,28\\\\}$ and $j\\in\\\\{0,\\ldots,29\\\\}$, we independently generate a random integer $\\gamma_{i,j}=\\mathrm{rand}(-D,D)$.\n3. If $M=1$, for each $j\\in\\\\{0,\\ldots,29\\\\}$ and $i\\in\\\\{0,\\ldots,28\\\\}$, we set $v_{i,j}=V_{j,0}+\\gamma_{i,j}$.\n4. If $M=2$, for each $j\\in\\\\{0,\\ldots,29\\\\}$, we generate a random integer $y_j=\\mathrm{rand}(1,28)$, and then for each $i\\in\\\\{0,\\ldots,y_j-1\\\\}$, we set $v_{i,j}=V_{j,0}+\\gamma_{i,j}$, and for each $i\\in\\\\{y_j,\\ldots,28\\\\}$, we set $v_{i,j}=V_{j,1}+\\gamma_{i,j}$.\n\n#### Generation of $s_k$, $t_k$\nThe vertices $s_k$ and $t_k$ given in the query are chosen uniformly at random among all the vertices.\nIf the Manhattan distance between $s_k$ and $t_k$ ($|si_k-ti_k|+|sj_k-tj_k|$) is strictly less than 10, we repeat the random selection until the distance becomes at least 10.\n\n\n\nTools\n--------\n- <a href=\"https://img.atcoder.jp/ahc003/c1ae4a8996958aa31f5f9d3aa3f51033.zip\">Local tester</a>: You need a compilation environment of <a href=\"https://www.rust-lang.org/\">Rust language</a>.\n- <a href=\"https://img.atcoder.jp/ahc003/e7eb814463364c249c93216eee64275.html\">Visualizer</a>\n- <a href=\"https://img.atcoder.jp/ahc003/499df4d8fb8c9326c7b718917d14f17a.zip\">Inputs</a>: If you don't use the above local tester, you can instead use these 100 inputs (seed 0-99) for local testing. These inputs are different from the actual test cases. The inputs are in the following format, and you can use them by writing a judge program by yourself.\n\n~~~\n$h_{0,0}$ $\\ldots$ $h_{0,28}$\n$\\vdots$\n$h_{29,0}$ $\\ldots$ $h_{29,28}$\n$v_{0,0}$ $\\ldots$ $v_{0,29}$\n$\\vdots$\n$v_{28,0}$ $\\ldots$ $v_{28,29}$\n$si_1$ $sj_1$ $ti_1$ $tj_1$ $a_1$ $e_1$\n$\\vdots$\n$si_{1000}$ $sj_{1000}$ $ti_{1000}$ $tj_{1000}$ $a_{1000}$ $e_{1000}$\n~~~\n\n#### Example of judge program (pseudo code)\n~~~\nstring query(s, t, prev_result) {\n\t// WRITE YOUR SOLUTION HERE\n}\n\nint main() {\n\tif (LOCAL_TEST) {\n\t\tread_h_v();\n\t}\n\tprev_result = 0;\n\tscore = 0.0;\n\tfor (int k = 0; k < 1000; k++) {\n\t\tif (LOCAL_TEST) {\n\t\t\tread_s_t_a_e();\n\t\t} else {\n\t\t\tread_s_t();\n\t\t}\n\t\tpath = query(s, t, prev_result);\n\t\tprint(path);\n\t\tif (LOCAL_TEST) {\n\t\t\tb = compute_path_length(path);\n\t\t\tscore = score * 0.998 + a / b;\n\t\t\tprev_result = round(b * e);\n\t\t} else {\n\t\t\tprev_result = read_result();\n\t\t}\n\t}\n\tif (LOCAL_TEST) {\n\t\tprint(round(2312311 * score));\n\t}\n\treturn 0;\n}\n~~~\n", "config": "\ntype: interactive\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 10s\nmemory: 256m\n\n# The subtasks section works the same way\nsubtasks:\n- score: 100\n n_cases: 75\n \n"}
|
|
|
|
| 256 |
{"problem_id": "bboplace_direct_ispd2005", "category": "2.0", "statement": "BBOPlace Direct ISPD2005\n=======================\n\nDirectly submit one JSON macro placement for a single BBOPlace ISPD2005 design:\n`adaptec1`. The hidden judge evaluates the placement with the original\nBBOPlace-Bench MGO MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour final submission is a JSON file at `/app/solution.json`. You are encouraged\nto write Python programs, shell scripts, search loops, local parsers, or any\nother helper code in `/app` while working. Those programs may generate and\noverwrite `/app/solution.json` many times. Only the final JSON artifact is\ngraded.\n\nThe agent container provides:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available for local helper scripts\n- hidden benchmark data is not available in the agent workspace\n\nThe judge also runs on CPU only. Do not rely on CUDA, DREAMPlace, Ray, or GPU\nplacement libraries for scoring.\n\nSubmission format\n-----------------\n\nSubmit exactly one placement for `adaptec1` by writing `/app/solution.json`.\nAfter your program writes the file, call `bash /app/submit.sh` to score that\nJSON. The JSON must use one of these forms:\n\n```json\n{\"placement\": [0.0, 0.0, \"...\"]}\n```\n\nor:\n\n```json\n{\"x\": [0.0, 0.0, \"...\"], \"y\": [0.0, 0.0, \"...\"]}\n```\n\nThe placement vector length must equal `dim = 2 * node_cnt`. The first\n`node_cnt` entries are x-grid coordinates and the remaining `node_cnt` entries\nare y-grid coordinates. Coordinates must be finite, with x in `[0, n_grid_x]`\nand y in `[0, n_grid_y]`. Only one placement is accepted.\n\nThe judge discloses public metadata through the iterative feedback path,\nincluding `dim`, `node_cnt`, `n_grid_x`, `n_grid_y`, and the baseline HPWL.\nThe netlist and evaluator source stay hidden in the judge image.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL for `adaptec1`:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe baseline constant is from the BBOPlace-Bench report, Table III,\n`MGO + Vanilla-EA` MP-HPWL. The paper reports values in units of `x10^5`; the\njudge stores the raw HPWL value relaxed by `1.2x`:\n\n- `adaptec1`: `6.96e5`\n\nBoth iterative submissions and final verification evaluate this same single\ndesign. The submit helper may still save the best iterative JSON artifact and\nrerun it during final verification.\n", "config": "tag: optimization\nruntime:\n language: json\n timeout_seconds: 10800\n environment: \"JSON placement for one hidden ISPD2005 BBOPlace design\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nsubmission:\n kind: file\n path: /app/solution.json\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 257 |
{"problem_id": "bboplace_iccad2015", "category": "2.0", "statement": "BBOPlace ICCAD2015\n==================\n\nWrite a Python solution that proposes macro placements for the BBOPlace MGO\nformulation on the ICCAD2015 benchmark suite. The hidden judge evaluates your\nplacements with the original BBOPlace-Bench MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour solution runs in the main agent container with:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available\n- internet access may be available during the trial, but the benchmark data is\n hidden and is not available in the agent workspace\n\nThe final verifier timeout is 10800 seconds. The judge also runs on CPU only.\nDo not rely on CUDA, DREAMPlace, Ray, or GPU placement libraries for scoring;\nthe official metric path used here is MGO with MP-HPWL.\n\nYour file must define one of:\n\n- `solve(info)`\n- `generate(info)`\n- `run(info)`\n- `CANDIDATES`, `CANDIDATE`, or `PLACEMENT`\n\nThe recommended interface is `solve(info)`. The judge calls it once per\nbenchmark. `info` contains:\n\n- `benchmark`: one of `superblue1`, `superblue3`, `superblue4`, `superblue5`,\n `superblue7`, `superblue10`, `superblue16`, `superblue18`\n- `dim`: placement vector length\n- `node_cnt`: number of macros\n- `n_grid_x`, `n_grid_y`: MGO grid bounds\n- `max_candidates_per_submission`: 16\n- `baseline_hpwl`: the baseline HPWL used for scoring\n\nReturn either one placement vector of length `dim`, or a 2D list/array with up\nto 16 placement candidates. For MGO, the first `node_cnt` entries are x-grid\ncoordinates in `[0, n_grid_x]`, and the remaining `node_cnt` entries are y-grid\ncoordinates in `[0, n_grid_y]`.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL. For each benchmark:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe final score is the mean score over the eight ICCAD2015 benchmarks. The\nunbounded score is the mean raw score before the zero clip.\n\nDuring iterative agent submissions, `/app/submit.sh` gives quick feedback on\n`superblue1` only. The final verifier evaluates the full eight-benchmark suite.\nUse the quick feedback to debug general placement logic, not as the complete\nleaderboard score.\n\nThe submit helper saves the best quick-feedback artifact it has seen. During\nfinal verification, the verifier reruns both the current `/app/solution.py` and\nthat saved best iterative artifact on the full suite, then uses the better\nfull-suite score. A quick-feedback score is never used directly as the final\nreward.\n\nThe baseline constants are from the BBOPlace-Bench report, Table V,\n`MGO + PSO` MP-HPWL. The paper reports values in units of `x10^5`; the judge\nstores raw HPWL values relaxed by `1.2x`:\n\n- `superblue1`: `0.696e5`\n- `superblue3`: `1.824e5`\n- `superblue4`: `1.128e5`\n- `superblue5`: `4.512e5`\n- `superblue7`: `2.028e5`\n- `superblue10`: `0.648e5`\n- `superblue16`: `1.152e5`\n- `superblue18`: `0.576e5`\n\nThe benchmark data and evaluator source are only present in the judge image.\nThey are not available in the agent workspace.\n", "config": "tag: optimization\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python solution returning BBOPlace MGO placement candidates; hidden ICCAD2015 judge data\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 258 |
{"problem_id": "bboplace_ispd2005", "category": "2.0", "statement": "BBOPlace ISPD2005\n=================\n\nWrite a Python solution that proposes macro placements for the BBOPlace MGO\nformulation on the ISPD2005 benchmark suite. The hidden judge evaluates your\nplacements with the original BBOPlace-Bench MP-HPWL evaluator.\n\nRuntime and resources\n---------------------\n\nYour solution runs in the main agent container with:\n\n- 8 CPU cores\n- 16 GiB memory\n- 8 GiB storage\n- no GPU\n- Python 3 with NumPy available\n- internet access may be available during the trial, but the benchmark data is\n hidden and is not available in the agent workspace\n\nThe final verifier timeout is 10800 seconds. The judge also runs on CPU only.\nDo not rely on CUDA, DREAMPlace, Ray, or GPU placement libraries for scoring;\nthe official metric path used here is MGO with MP-HPWL.\n\nYour file must define one of:\n\n- `solve(info)`\n- `generate(info)`\n- `run(info)`\n- `CANDIDATES`, `CANDIDATE`, or `PLACEMENT`\n\nThe recommended interface is `solve(info)`. The judge calls it once per\nbenchmark. `info` contains:\n\n- `benchmark`: one of `adaptec1`, `adaptec2`, `adaptec3`, `adaptec4`,\n `bigblue1`, `bigblue3`\n- `dim`: placement vector length\n- `node_cnt`: number of macros\n- `n_grid_x`, `n_grid_y`: MGO grid bounds\n- `max_candidates_per_submission`: 16\n- `baseline_hpwl`: the baseline HPWL used for scoring\n\nReturn either one placement vector of length `dim`, or a 2D list/array with up\nto 16 placement candidates. For MGO, the first `node_cnt` entries are x-grid\ncoordinates in `[0, n_grid_x]`, and the remaining `node_cnt` entries are y-grid\ncoordinates in `[0, n_grid_y]`.\n\nScore\n-----\n\nThe objective is to minimize MP-HPWL. For each benchmark:\n\n`raw_score = 100 * (baseline_hpwl - candidate_hpwl) / baseline_hpwl`\n\n`score = max(0, raw_score)`\n\nThe final score is the mean score over the six ISPD2005 benchmarks. The\nunbounded score is the mean raw score before the zero clip.\n\nDuring iterative agent submissions, `/app/submit.sh` gives quick feedback on\n`adaptec1` only. The final verifier evaluates the full six-benchmark suite.\nUse the quick feedback to debug general placement logic, not as the complete\nleaderboard score.\n\nThe submit helper saves the best quick-feedback artifact it has seen. During\nfinal verification, the verifier reruns both the current `/app/solution.py` and\nthat saved best iterative artifact on the full suite, then uses the better\nfull-suite score. A quick-feedback score is never used directly as the final\nreward.\n\nThe baseline constants are from the BBOPlace-Bench report, Table III,\n`MGO + Vanilla-EA` MP-HPWL. The paper reports values in units of `x10^5`; the\njudge stores raw HPWL values relaxed by `1.2x`:\n\n- `adaptec1`: `6.96e5`\n- `adaptec2`: `73.752e5`\n- `adaptec3`: `67.356e5`\n- `adaptec4`: `68.148e5`\n- `bigblue1`: `2.76e5`\n- `bigblue3`: `62.88e5`\n\nThe benchmark data and evaluator source are only present in the judge image.\nThey are not available in the agent workspace.\n", "config": "tag: optimization\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python solution returning BBOPlace MGO placement candidates; hidden ISPD2005 judge data\"\n apt_packages:\n - python3-numpy\n docker:\n image: ubuntu:24.04\n judge_image: ghcr.io/frontiercs/frontiercs-bboplace-data:2026-06-ispd-iccad\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\n"}
|
| 259 |
+
{"problem_id": "duckdb_e2e_query_optimization", "category": "2.0", "statement": "# DuckDB E2E Query Optimization\n\n## Problem\n\nThis is an experimental systems task. You are given a pinned DuckDB checkout in\nthe Harbor workspace and may modify DuckDB itself. Your goal is to improve\nend-to-end TPC-H style analytical query performance while preserving the\ncorrectness and generality of DuckDB's SQL execution.\n\nThe intended optimization area is end-to-end analytical query optimization:\njoin ordering, predicate transfer, join-side filtering, cardinality robustness,\nand closely related optimizer/execution wiring. Strong submissions should\nimprove TPC-H geometric mean runtime without hard-coding TPC-H tables, queries,\nbenchmark paths, or judge details.\n\n## Workload\n\nThe public workload family is DuckDB's built-in TPC-H query set. The public\nscale factor is 1, and the experimental judge evaluates q1 through q22 with\nDuckDB's TPC-H extension, for example by generating data with `CALL dbgen(...)`\nand running queries through `PRAGMA tpch(n)`. DuckDB also exposes its TPC-H\nquery text through the extension in normal DuckDB development workflows.\n\nTreat those queries as a representative analytical workload, not as strings to\nrecognize. The judge may include additional non-public scale-factor groups, and\nit may vary query order, repetitions, and correctness coverage. Submissions\nshould implement general optimizer and execution improvements rather than\nTPC-H-specific special cases.\n\n## Submission\n\nThe submitted artifact is a patch file:\n\n```text\n/app/solution.patch\n```\n\nThe agent workspace is expected to contain a DuckDB checkout at:\n\n```text\n/app/duckdb\n```\n\nAfter modifying DuckDB, generate and submit a patch:\n\n```bash\nbash /app/make_submission.sh\nbash /app/submit.sh\n```\n\nSubmissions are asynchronous. For this task, submit an initial small, plausible\npatch as soon as it is generated, then continue local review or compilation\nwhile the judge works. A full local DuckDB build in the agent container can\nconsume most of the agent budget and is not required before the first\nsubmission; the judge builds the submitted patch from a clean prebuilt source\ntree with fixed resource settings.\n\nThe judge applies the patch to a clean pinned DuckDB source tree, builds DuckDB\nwith the TPC-H extension enabled, and times the evaluated TPC-H queries from\nthe judge side. Submitted binaries, build artifacts, generated benchmark files,\nand local timing logs are ignored.\n\n## Correctness\n\nCorrectness is a gate. Patched DuckDB must produce the same SQL results as\nvanilla DuckDB on the evaluated workload. Build failures, patch failures,\nincorrect query results, crashes, timeouts, and out-of-memory failures are\npenalized before performance is considered.\n\nThe experimental evaluator currently encodes the patch policy, timing\norchestration, and vanilla-vs-patched TPC-H result comparison inside the custom\njudge image. During iterative asynchronous submissions, the judge keeps feedback\nfocused on the public scale-factor TPC-H gate so agents can submit early and\ncontinue working while evaluation runs. During final verification, the judge\nuses the broader hidden scale-factor set and also runs a small DuckDB\nSQLLogicTest smoke set covering join, filter, and aggregate behavior before\ntiming is considered.\n\n## Scoring\n\nValid submissions are scored by speedup relative to vanilla DuckDB on the same\nhardware, same benchmark list, same clean environment, and same resource limits.\nFor each benchmark query:\n\n```text\nspeedup = vanilla_time / patched_time\n```\n\nThe primary objective is the geometric mean of per-query speedups. The bounded\nscore is derived from that geometric mean so that a 1.0x result earns 0 points,\nregressions also earn 0 points, and broad speedups are preferred over a single\nlarge outlier. The raw geometric mean speedup is reported in evaluator metrics.\n\n## Patch Policy\n\nThe evaluator validates the patch before building. The policy is intentionally\nstricter than normal DuckDB development because this task is graded by hidden\nbenchmarks.\n\nAllowed optimizer and execution areas:\n\n```text\nsrc/optimizer/**\nsrc/include/duckdb/optimizer/**\nsrc/execution/operator/join/**\nsrc/include/duckdb/execution/operator/join/**\nsrc/execution/operator/filter/**\nsrc/include/duckdb/execution/operator/filter/**\nsrc/planner/operator/logical_join.cpp\nsrc/planner/operator/logical_comparison_join.cpp\nsrc/include/duckdb/planner/operator/logical_join.hpp\nsrc/include/duckdb/planner/operator/logical_comparison_join.hpp\n```\n\nConditionally allowed narrow wiring areas:\n\n```text\nsrc/planner/**\nsrc/include/duckdb/planner/**\nsrc/execution/physical_plan/**\nsrc/include/duckdb/execution/physical_plan/**\nsrc/common/**\nsrc/include/duckdb/common/**\n```\n\nNew C++ and header files are allowed in these areas. Build-system edits are\nallowed only to add newly introduced `.cpp` files to existing DuckDB build\ntargets. Build changes that alter compiler flags, link flags, targets,\ngenerated code, install paths, external dependencies, benchmark behavior, or\nruntime paths are invalid.\n\nAllowed build-system files:\n\n```text\nCMakeLists.txt\nsrc/CMakeLists.txt\nsrc/optimizer/CMakeLists.txt\nsrc/optimizer/**/CMakeLists.txt\nsrc/planner/CMakeLists.txt\nsrc/planner/**/CMakeLists.txt\nsrc/planner/operator/CMakeLists.txt\nsrc/common/CMakeLists.txt\nsrc/common/**/CMakeLists.txt\nsrc/execution/CMakeLists.txt\nsrc/execution/operator/CMakeLists.txt\nsrc/execution/operator/join/CMakeLists.txt\nsrc/execution/operator/join/**/CMakeLists.txt\nsrc/execution/operator/filter/CMakeLists.txt\nsrc/execution/operator/filter/**/CMakeLists.txt\nsrc/execution/physical_plan/CMakeLists.txt\nsrc/execution/physical_plan/**/CMakeLists.txt\nextension_config.cmake\n```\n\nForbidden areas include benchmark files, tests, scripts, TPC-H extension code,\nthird-party code, parser/catalog/storage internals, DuckDB main/client context,\ndocumentation, examples, CI files, package manifests, and timing/scoring code.\n\nPatches may not add environment-variable reads or writes. The judge builds and\nruns both vanilla and patched DuckDB under a minimal fixed environment with no\nFrontier, Harbor, judge, secret, or submission-specific environment variables\ninherited by benchmark subprocesses.\n\nPatches also may not hard-code TPC-H table names, query numbers, benchmark\nnames, or benchmark paths in optimizer/execution code.\n\n## Resource Budget\n\nThe experimental Harbor budget is:\n\n```text\nvCPUs: 8\nmemory: 16 GiB\nstorage: 32 GiB\nbuild timeout: 7200 seconds\nquery timeout: 300 seconds\nDuckDB child process address-space limit: 12288 MiB\n```\n\nThe judge runs each build and benchmark step in a subprocess with a clean\nenvironment. DuckDB benchmark runs are configured with fixed thread, memory,\nand temporary-directory limits in the judge image to reduce the chance that a\nbad plan crashes the judge service.\n\nThe evaluator runs both vanilla and patched DuckDB with the same SQL runtime\nsettings before data generation, correctness checks, and timing:\n\n```sql\nSET threads = 1;\nSET memory_limit = '6GB';\nSET max_temp_directory_size = '2GB';\nSET temp_directory = '<judge temp directory>';\nSET preserve_insertion_order = false;\n```\n\nSubprocesses receive a minimal fixed environment with only basic execution\npaths, locale settings, an isolated home directory, an isolated temp directory,\nand an isolated ccache directory.\n", "config": "tag: systems\nruntime:\n language: cpp\n timeout_seconds: 10800\n environment: \"DuckDB source patch; TPC-H shell timing; experimental judge\"\n apt_packages:\n - bash\n - build-essential\n - ca-certificates\n - ccache\n - cmake\n - git\n - ninja-build\n - pkg-config\n - python3\n judge_apt_packages:\n - bash\n - build-essential\n - ca-certificates\n - ccache\n - cmake\n - git\n - ninja-build\n - pkg-config\n - python3\n docker:\n # Experimental local images. Build them with\n # 2.0/problems/duckdb_e2e_query_optimization/docker/build_images.sh before running a\n # local Harbor trial.\n image: frontiercs/duckdb-e2e-query-optimization-agent:experimental-v1.5.3\n judge_image: frontiercs/duckdb-e2e-query-optimization-judge:experimental-v1.5.3\nenvironment:\n cpus: 8\n memory_mb: 16384\n storage_mb: 32768\n build_timeout_seconds: 7200\nevaluation:\n scale_factor: 1\n agent_scale_factors:\n - 1\n benchmark_repetitions: 3\n build_timeout_seconds: 7200\n query_timeout_seconds: 300\n sqllogictest_timeout_seconds: 600\n duckdb_memory_limit: \"6GB\"\n duckdb_temp_limit: \"2GB\"\n child_memory_mb: 12288\nsubmission:\n kind: file\n path: /app/solution.patch\n"}
|
| 260 |
{"problem_id": "erdos_demo", "category": "2.0", "statement": "# Erdos Unit Distance Demo\n\n## Problem\n\nPlace exactly `N = 10` distinct points in the Euclidean plane so that the\nnumber of point pairs at Euclidean distance exactly `1` is as large as possible.\n\nThis is a tiny, visually inspectable demo version of the planar unit distance\nproblem. If your construction naturally has a different common distance, scale\nthe coordinates before returning them.\n\n## Program Interface\n\nSubmit a Python file defining one of the following:\n\n```python\ndef solve(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\ndef generate_points(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\nPOINTS = [(0.0, 0.0), (1.0, 0.0), ...]\n```\n\nThe returned value must contain exactly 10 two-dimensional points. No stdin is\nused.\n\n## Validity Constraints\n\nA solution is valid if:\n\n1. It returns exactly 10 points.\n2. Every coordinate is a finite real number.\n3. No two points are closer than `1e-6`.\n\nThe objective is translation-invariant. Very large coordinates are allowed as\nlong as pairwise squared distances remain finite.\n\n## Objective\n\nFor all unordered point pairs, count those whose squared Euclidean distance is\nequal to `1` within a small floating-point tolerance. Let `M` be that count.\n\nMaximize `M`.\n\n## Scoring\n\nThe score is naturally scaled to `[0, 100)`, without clipping against a fixed\ntarget. Let:\n\n```text\nbaseline = N\nX = M\n```\n\nIf the point set is invalid, or if `X <= baseline`, the score is `0`. Otherwise:\n\n```text\nscore = 100 * (X - baseline) / X\n```\n\nThis makes the simple `N`-pair baseline worth `0`. With only 10 points, the\nproblem is intended as a quick sanity check and visual demo for agent workflows.\n", "config": "tag: geometry\nruntime:\n language: python\n timeout_seconds: 300\n environment: \"Python 3.11; no external packages required\"\n docker:\n image: ubuntu:24.04\n"}
|
| 261 |
{"problem_id": "erdos_unit_distance", "category": "2.0", "statement": "# Erdos Unit Distance\n\n## Problem\n\nPlace exactly `N = 65536` distinct points in the Euclidean plane so that the\nnumber of point pairs at Euclidean distance exactly `1` is as large as possible.\n\nThis is a finite, executable version of the planar unit distance problem:\ngiven `n` points, maximize the number of pairs at distance exactly `1`. If your\nconstruction naturally has a different common distance, scale the coordinates\nbefore returning them.\n\n## Program Interface\n\nSubmit a Python file defining one of the following:\n\n```python\ndef solve(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\ndef generate_points(n: int) -> list[tuple[float, float]]:\n ...\n```\n\nor:\n\n```python\nPOINTS = [(0.0, 0.0), (1.0, 0.0), ...]\n```\n\nThe returned value must contain exactly 65536 two-dimensional points. No stdin\nis used.\n\n## Validity Constraints\n\nA solution is valid if:\n\n1. It returns exactly 65536 points.\n2. Every coordinate is a finite real number.\n3. No two points are closer than `1e-3`.\n\nThe objective is translation-invariant. Very large coordinates are allowed as\nlong as pairwise squared distances remain finite.\n\n## Objective\n\nFor all unordered point pairs, count those whose squared Euclidean distance is\nequal to `1` within a strict floating-point tolerance. Let `M` be that count.\n\nMaximize `M`.\n\n## Scoring\n\nThe score is naturally scaled to `[0, 100)`, without clipping against a fixed\ntarget. Let:\n\n```text\nbaseline = N\nX = M\n```\n\nIf the point set is invalid, or if `X <= baseline`, the score is `0`. Otherwise\nthe raw score is:\n\n```text\nraw_score = 100 * (X - baseline) / X\n```\n\nThe reported score applies a cubic scale:\n\n```text\nscore = 100 * (raw_score / 100)^3\n```\n\nThis makes the simple `N`-pair baseline worth `0`, rewards every improvement\nabove the baseline, and keeps high-scoring constructions from saturating the\nbenchmark too quickly. The bounded and unbounded score fields both report this\ncubic-scaled score; evaluator messages also include `raw_score` for reference.\n", "config": "tag: geometry\nruntime:\n language: python\n timeout_seconds: 10800\n environment: \"Python 3.11; no external packages required\"\n docker:\n image: ubuntu:24.04\n"}
|
| 262 |
{"problem_id": "vector_db_ann", "category": "2.0", "statement": "# Vector DB ANN\n\n## Problem\n\nBuild a fast approximate nearest-neighbor vector search engine for a\nSIFT1M-scale benchmark.\n\nThe hidden benchmark contains exactly `1,000,000` base vectors with dimension\n`128`. Queries use the same dimension, distance is squared Euclidean distance,\nand each query asks for the top `10` nearest vector ids.\n\nYour objective is to maximize serving throughput while preserving search\nquality: submissions must reach `recall@10 >= 0.95`, and valid submissions are\nranked by an effective QPS that includes query time plus a small load/index-build\npenalty.\n\nThe Harbor agent container starts with a small Rust skeleton project in\n`/app`. You may use it, modify it, or replace it entirely. You may also use any\nRust crates, internal harness, data structures, and build layout you want, as\nlong as the final project satisfies the judge contract below.\n\nThe judge builds and runs your service with:\n\n```bash\ncargo build --release\nPORT=<port> cargo run --release --quiet\n```\n\nThe Harbor environment uses the Ubuntu `apt` Rust toolchain:\n\n```text\nrustc 1.75\ncargo 1.75\n```\n\nIf you add crates, choose versions compatible with this toolchain or pin\ntransitive dependencies accordingly.\n\nThe service and judge run with the task resource limits below. Design your\nparallel search and indexing strategy for this budget:\n\n```text\nvCPUs: 8\nmemory: 16 GiB\nquery concurrency: 8\ntimed queries per worker: 64\n```\n\nThe service must listen on `PORT` and implement these endpoints:\n\n```text\nPOST /insert\nPOST /bulk_insert\nPOST /search\n```\n\n`/bulk_insert` receives:\n\n```json\n{\"vectors\":[{\"id\":0,\"vector\":[0.1,0.2,...]}]}\n```\n\nand returns:\n\n```json\n{\"status\":\"ok\",\"inserted\":1}\n```\n\n`/search` receives:\n\n```json\n{\"vector\":[0.1,0.2,...],\"top_k\":10}\n```\n\nand returns:\n\n```json\n{\"results\":[{\"id\":0,\"distance\":0.0}]}\n```\n\n## Local Harness\n\nThe official evaluator uses hidden data and a black-box judge. You may call:\n\n```bash\nbash /app/submit.sh\n```\n\nat any time to submit the current `/app` project to the official judge and get\nscore feedback.\n\n## Validity\n\nA submission is valid if:\n\n1. It builds successfully with `cargo build --release`.\n2. `cargo run --release --quiet` starts the service and implements the required HTTP\n endpoints.\n3. Every returned id is in `[0, 1_000_000)`.\n4. Its `recall@10` is at least `0.95` against the hidden exact top-10 ground\n truth.\n\n## Scoring\n\nAt trial startup, the Harbor judge sidecar prepares the hidden benchmark and\nruns an exact-search reference HTTP service through the same `/bulk_insert`\nand `/search` client harnesses to produce ground-truth nearest neighbors and\nthe trial-local scoring baseline:\n\n```text\nbaseline_qps\nbaseline_effective_qps\nbaseline_load_seconds\n```\n\nInteractive submissions and the final verifier both score through this same\njudge sidecar, so the baseline and runtime environment are shared within a\ntrial while still letting different machines measure their own local baseline.\n\nEach submission is then timed independently. The load phase includes all\n`/bulk_insert` calls and any index construction performed by the service before\nqueries begin. The query phase uses 8 concurrent workers, each issuing 64\nqueries, and measures only `/search` throughput:\n\n```text\ncandidate_qps\ncandidate_load_seconds\n```\n\nThe reported `qps` is the raw query-only QPS. Scoring uses an effective QPS\nthat includes a small index-build/load penalty:\n\n```text\neffective_qps = Q / (query_seconds + 0.01 * load_seconds)\n```\n\nThe load phase has a default `900s` timeout. This keeps the benchmark focused\non serving performance while still making very expensive offline indexing pay a\nbounded, explicit cost.\n\nDuring evaluation, the load and query phases may stop early and return `0` once\nthe elapsed time plus the load penalty makes it impossible for the final\neffective QPS to beat the baseline. During load, this assumes a best-case query\ntime of zero.\n\nIf the submission is invalid, if `recall@10 < 0.95`, or if\n`candidate_effective_qps <= baseline_effective_qps`, the score is `0`.\nOtherwise:\n\n```text\nscore = 100 * (1 - sqrt(baseline_effective_qps) / sqrt(candidate_effective_qps))\n```\n\nThe bounded and unbounded score fields both report this score. Harbor JSON\nresults include the measured `qps`, `effective_qps`, `baseline_qps`,\n`baseline_effective_qps`, `recall_at_10`, load time, and runtime metrics under\nthe `metrics` field.\n", "config": "tag: systems\nruntime:\n language: rust\n timeout_seconds: 10800\n environment: \"Rust project; hidden ANN benchmark; Python/NumPy judge\"\n apt_packages:\n - build-essential\n - cargo\n - git\n - rustc\n judge_apt_packages:\n - build-essential\n - cargo\n - rustc\n - python3-pip\n - python3-numpy\n judge_pip_packages:\n - faiss-cpu\n docker:\n image: ubuntu:24.04\nenvironment:\n # If these resource limits change, also update the resource budget text in\n # readme and harbor/app/README.md so agents can design parallel algorithms\n # for the actual CPU and memory budget.\n cpus: 8\n memory_mb: 16384\n storage_mb: 8192\n build_timeout_seconds: 3600\nevaluation:\n # The judge drives the search service with this many concurrent workers.\n # Keep this aligned with the CPU budget unless the task is intentionally\n # changed into a higher-concurrency service benchmark.\n query_concurrency: 8\n queries_per_worker: 64\nsubmission:\n kind: directory\n path: /app\n exclude:\n - target\n - .git\n - .frontier-cs\n"}
|