Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results333 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| GIGA Universe CupGiven four of the six group matches, compute the probability the starred team finishes in the top two, including tie-breaking and random lots. | Medium7 | ProbabilityCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| English RestaurantGiven n tables and random hourly group sizes from 1 to g, find the expected number of seated people after t hours, where each group takes the smallest table that fits. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Knockout TournamentArrange the starting line-up of a knockout tournament so that Dale's probability of winning, given pairwise win odds a/(a+b), is maximized. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| CoinsMaintain the probability that the number of heads among N coins is odd, under M point updates to individual coin probabilities, and report which outcome is more likely after each update. | Medium7 | MathProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Explosion ExploitGiven up to 10 minions with health at most 6 and d up to 100, find the chance that uniformly random sequential damage kills every opposing minion. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 3s | 512 MB | Judgeable |
| New SalariesSalaries are drawn from nested closed intervals. Compute the expected total pairwise salary gaps and output it divided by N squared. | Medium7 | Prefix sumMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Back to the BonesGiven N rolled dice and a target K, reroll any subset once to maximize the chance the sum reaches K, and report 6^N times that probability together with one optimal subset. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Rainwater on a TreeWater starts at the root and each vertex sends 1 unit per second to a uniformly random child; find the average expected final water over vertices that hold any water. | Medium7 | TreeProbability+2 | No attempts yet | 1s | 512 MB | Judgeable |
| JackpotChoose how many of n doors to open first so that the probability of picking the prize times the reduced prize is largest; output that best expected payout. | Medium7 | MathBinary search+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Research Productivity IndexChoose any subset of n papers with known acceptance probabilities to maximize the expected value of a^a/s, where s is the subset size and a the number accepted. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Lucky DrawFor n players with k lives each flipping a biased coin every round, compute the probability the game ends in a draw. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RGB JengaTwo players alternately draw red, green, or blue blocks of given weights; the first draw that pushes the total removed weight to at least N loses, and you must say which player wins with higher probability. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| AssassinsGiven chronological assassination attempts with success probabilities, find the probability each of n assassins is alive at the end, where a dead assassin's attempts are cancelled. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Final StandingsGiven each team's strength, each problem's difficulty, and a frozen scoreboard, compute the probability that team t ends up in first place, assuming ties always go to team t. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Bogo SortSort a hidden permutation using only calls that randomly shuffle a chosen contiguous segment and report the shuffled result. | Medium7 | SortingProbability+2 | No attempts yet | 4s | 1024 MB | Judgeable |
| Farming MarsFor each query interval, decide whether some exact pH value occurs more than half the time within that interval. | Medium7 | Hash mapDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Petr's AlgorithmGiven a permutation produced by randomly shuffling every length-k window left to right, recover k. The input guarantees 20k is at most n. | Medium7 | ProbabilityMath+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Game Of ChanceFor each m, find the limit of the expected score difference in a two-player optimal-stopping game where the choice holder assigns a random number to themselves or the opponent. | Medium7 | ProbabilityGame theory+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Baklava TrayFor a regular N-gon of area 1, nested polygons join midpoints forever; find the expected total nut types hit by 10^4 random points. | Medium7 | MathGeometry+2 | No attempts yet | 12s | 512 MB | Judgeable |
| Flipping El-fetieraEach of K operations picks a uniformly random rectangular submatrix and flips every cell in it; compute the expected number of cells holding 1 at the end. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 10s | 512 MB | Judgeable |
| DotA QualsGiven 2^n players and Idned ranked k-th, compute the expected number of rounds he survives when opponents are randomly paired each round and the higher rating always wins. | Medium7 | ProbabilityCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Coin Passing GameGiven biased left/right passing probabilities on a circle of N students starting at student K, compute the probability that student N is the last student to first receive the coin. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Random SortCompute the expected number of random inversion swaps needed to sort a permutation of size at most 8 into increasing order. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Expected Repaints for BallsGiven N colored balls, compute the expected number of random repaint operations needed until all balls share one color. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 128 MB | Judgeable |
| MazeGiven a tree-like maze grid, compute the expected number of steps for a random depth-first exploration (choosing unvisited branches uniformly, backtracking on dead ends) to travel from entrance to exit. | Hard8 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| InterconnectGiven an initial graph on up to 30 towns, compute the exact expected number of random-edge additions needed until the graph becomes fully connected, as a reduced fraction. | Hard8 | Union-findMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Teleport Out!Grid maze with exits; each step you either walk to an adjacent open cell or teleport to a uniformly random open cell. Find the minimum expected number of steps to reach an exit. | Hard8 | Dynamic programmingBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cover UpGiven up to 5000 boards, each with d columns of distinct digits, compute the probability the contestant eventually wins Cover Up, assuming uniform random picks among untried digits in unfinished columns. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Borg BoogieGiven a connected undirected graph and a fixed walk, find the probability that a random-walking sentry never collides or swaps with the captain during the walk. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BlackjackGiven the exact order of the remaining deck, decide which hands to play, how much to bet, and when to hit or stand, to maximize total profit. | Hard8 | Dynamic programmingGame theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Another Dice GameCompute the probability that Jan reaches a target score of n in Pickomino with optimal play, given the dice, set-aside and worm rules. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Good CoalitionEach party has seats and a survival probability; find the party subset holding at least 76 seats whose product of probabilities is maximized, and print it as a percentage. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime SquareFind all 5x5 digit grids whose five rows, five columns and two diagonals are five-digit primes with the same given digit sum and a fixed top-left digit, printed in lexicographic order. | Hard8 | BacktrackingNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Square LotteryCount, over all permutations of 1 to N^2 on an N by N grid, the expected number of winning tickets for a random set of four corners forming a square, then divide the prize pool. | Hard8 | CombinatoricsMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The (Bayesian) Hound and the HareMaintain a Bayesian belief over a hare's random-walk position, apply noisy observations, and greedily move the hound to the cell with least expected maze distance. | Hard8 | ProbabilityBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Drunken WalkIn a weighted DAG, remove at most one edge to maximize the expected number of edges walked from vertex 0 before reaching a sink. | Hard8 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hey, Better BettorGiven a refund rate on final losses and a win chance below half per dollar bet, compute the maximum expected profit over any stopping strategy. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 4s | 128 MB | Judgeable |
| Bribing the SyndicateChoose an adaptive bribery order within a fixed budget to maximize the chance of gaining at least c defectors. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 128 MB | Judgeable |
| Crusher's CodeCompute the expected number of loop iterations for two randomized swap sorts on arrays of up to 8 values. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Mixing ColoursThe player picks one colour per token and merges adjacent tokens under the rules to maximize the product of picked certainties, breaking ties in ASCII order. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 128 MB | Judgeable |
| Palindrome TripCompute the chance that a uniform random walk from s to t spells a palindrome, stopping early when t becomes unreachable. | Hard8 | ProbabilityGraph+2 | No attempts yet | 10s | 128 MB | Judgeable |
| PachinkoA ball wanders a grid with random moves and absorbing targets, and each target needs its hit probability from a uniform top-row start. | Hard8 | ProbabilityGraph+1 | No attempts yet | 6s | 512 MB | Judgeable |
| Slave to Achievements 3Starting from M scraps, repeated crafting and dismantling ends with fewer than N scraps, and you must report each final remainder probability modulo 1e9+7. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 3s | 256 MB | Judgeable |
| The last wizardTen counters start at 1 and grow through T random additive updates; output their expected product scaled by A to the T modulo 1000000007. | Hard8 | ProbabilityCombinatorics+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Birthday PartyEach of N guests gives a present to a random other guest, and you must compute the probability that some k guests form a directed gift cycle. | Hard8 | CombinatoricsProbability+1 | No attempts yet | 5s | 256 MB | Judgeable |
| Absurdistan Roads IIN cities each build a road to one random other city; compute the probability that the N roads connect all cities. | Hard8 | CombinatoricsProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Just a QuizTeresa interrupts randomly drawn known questions at chosen words to maximize expected correct answers within t seconds. | Hard8 | Dynamic programmingTrie+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Splitting into PrimesStarting from N, repeatedly split every composite into a random divisor pair and report the expected number of rounds until all parts are prime. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Butterfly EffectDecide adaptively where to spend up to k double-die rolls across n chained chance events to maximize the chance the last event ends positive. | Hard8 | Dynamic programmingProbability | No attempts yet | 5s | 256 MB | Judgeable |
| ARAM (Large)Decide when to spend reroll currency on random champions to maximize the long-run win rate over many games. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 120s | 512 MB | Judgeable |
| Observation Wheel (Large)Compute the expected total fare collected as visitors starting at uniform random gondolas fill all free spots on a circular wheel. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Falling Diamonds (Large)N diamonds drop onto x=0 and slide left or right at random, and each query asks the probability that a diamond rests exactly at (X, Y). | Hard8 | ProbabilitySimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Upstairs and DownstairsKonstantin chooses and orders at least K activities from limited copies to minimize the chance Ilia wakes after falling asleep. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Upstairs and DownstairsKonstantin must order at least K activities with capped repeats to minimize the chance Ilia falls asleep and later wakes. | Hard8 | ProbabilityGreedy+1 | No attempts yet | 100s | 512 MB | Judgeable |
| Commute War (Large)Choose connecting services to minimize expected travel time when departures leave hourly and each ride faces repeated random inspection delays. | Hard8 | Shortest pathProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Google RoyalePick starting and doubling coin-flip bets to maximize the chance of growing A dollars into V dollars before going broke. | Hard8 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Champion Sort (Small)Compute the minimum expected number of random subset shuffles that sorts a permutation of 1 to N into increasing order. | Hard8 | ProbabilityCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Test Passing Probability (Large Input)With M submissions allowed and independent per-question probabilities, choose answers to maximize the chance that one submission is fully correct. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Becoming a MillionaireBet any fraction of your money each round to maximize the chance of ending with at least one million dollars. | Hard8 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Millionaire (Large)Bet any fraction of your money over M rounds with win probability P; maximize the chance of holding $1,000,000 at the end. | Hard8 | Dynamic programmingProbability | No attempts yet | 20s | 512 MB | Judgeable |
| Fly Swatter (Small)Compute the probability that a randomly placed fly disk touches a circular ring crossed by a grid of cylindrical strings, and print it to six decimals. | Hard8 | GeometryMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Fly Swatter (Large)Given the racquet geometry, compute the probability that a fly of radius f, centered uniformly in the outer circle, overlaps the ring or any string. | Hard8 | GeometryMath+2 | No attempts yet | 20s | 512 MB | Judgeable |
| Points on a CircleGiven n random points on a unit circle and an angle p, compute -log2 of the probability that all n points fit inside some arc of central angle p. | Hard8 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| King of ChairsArrange N ladies, each sitting or standing with probability 1/2, to maximize the expected number of ordered pairs where the person behind is strictly taller. | Hard8 | SortingGreedy+2 | No attempts yet | 1s | 32 MB | Judgeable |
| WoodworkingGiven plank recovery probabilities for a box needing N planks, compute the expected number of boxes built starting with M planks. | Hard8 | Dynamic programmingProbability+1 | No attempts yet | 7s | 512 MB | Judgeable |
| HandshakesCompute the expected number of random handshakes until all N people belong to one acquaintance component, and output it modulo 1e9+7. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 4s | 512 MB | Judgeable |
| Black and WhiteEach cell is black or white with probability 1/2; find the expected product of the number of all-black subrectangles and all-white subrectangles. | Hard8 | CombinatoricsProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| CasinoWith N players, M areas, and K rounds of random elimination, find the best survival probability for the group. | Hard8 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Beauty of the sequenceGiven N trees with independent uniform height ranges, find the expected maximum beauty of a zigzag subsequence. | Hard8 | Dynamic programmingProbability | No attempts yet | 2s | 512 MB | Judgeable |
| Hot PotatoFor each query range, find the smallest X maximizing the gap between ending and not ending, given a functional graph walk from a uniform random start. | Hard8 | GraphProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ExamGiven each student's fixed semester points and a distribution of exam points, find the probability that the grade string avoids all forbidden substrings. | Hard8 | Dynamic programmingString matching+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| Expected Number of Connected ComponentsFor each node i with inclusion probability P_i, find the expected number of connected components of the subgraph where two selected nodes are adjacent when gcd > 1, then print E times 100^N mod 1e9+7. | Hard8 | ProbabilityMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| SortFor an array of at most 8 elements, compute the expected number of random-swap steps until sorted for two different swap schemes. | Hard8 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Splitting Game LevelsPartition n levels into k consecutive groups to minimize the expected total time of a random coin-draw process, and print it to six decimals. | Hard8 | Dynamic programmingDivide and conquer+2 | No attempts yet | 2s | 512 MB | Judgeable |
| PianoGiven N equally likely piano tones, find the expected number of presses until a fixed M-tone sequence appears, for every prefix of it. | Hard8 | String matchingDynamic programming+2 | No attempts yet | 1s | 64 MB | Judgeable |
| Core Training (Small2)Distribute U training units among N cores, each unit adding 1 to a core's success probability (capped at 1), to maximize the chance that at least K cores succeed. | Hard8 | Dynamic programmingGreedy+2 | No attempts yet | 5s | 512 MB | Judgeable |
| GhostbustersGiven independent button press probabilities, find the most likely set of pressed buttons that produces the observed row-to-column connectivity signals. | Hard8 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Uncertainty of PoliticsEach hearing has a start time and a uniform integer length in [a,b]; pick hearings to attend fully so the expected count is maximized. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Haggling With a WitcherGiven an unknown target fee uniform on [L,R], maximize expected gold by naming fees over time, where each attempt or save-reload costs 100 ms and time is capped by T. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Battle for WesnothChoose positive d and b with d*b <= m to maximize the chance that the total damage of b independent blows, each landing with probability p/100 and dealing d, kills a unit with h hitpoints; report the smallest-d, smallest-b optimum or 1 1 if impossible. | Hard8 | ProbabilityMath+2 | No attempts yet | 0.1s | 1024 MB | Judgeable |
| Gambling GuideOn an undirected graph, find the minimum expected number of random tickets (with rejection allowed) needed to travel from city 1 to city n. | Hard8 | GraphProbability+2 | No attempts yet | 3s | 512 MB | Judgeable |
| MultisectGiven a hidden failing revision among n candidates and up to K simultaneous tests per round, find the strategy that minimizes expected total cost when a round with i failures costs T_i. | Hard8 | Dynamic programmingBinary search+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Catch the PlaneChoose an adaptive strategy of buses to maximize the probability of reaching station 1 by time k, where each bus runs independently with a known probability. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 10s | 1024 MB | Judgeable |
| Gem IslandAt each of d steps a uniformly random gem splits in two; find the expected total held by the r largest holders after d splits. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Random Number GeneratorGiven how many values from 1 to N have been seen zero or one time, find the expected number of draws until every value appears at least twice. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| HorsemeetTwo knights move randomly to legal knight-move squares on an 8x8 board; find which knight has the higher probability of being the first to land on the other's square. | Hard8 | ProbabilityGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Numbers GeneratorGiven up to ten H/T patterns of the same length, compute the expected number of fair coin flips until one pattern first appears contiguous. | Hard8 | String matchingHash map+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Balance BeamChoose at each beam position a cash value or a fair coin random walk stopped at the ends, maximizing expected payment for every starting position. | Hard8 | Dynamic programmingMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gravity PointA random mass for tiles A and B is drawn from given ranges; find the chance the grid's center of gravity falls in a filled cell. | Hard8 | GeometryProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Heaps of FunGiven a rooted tree where each node i draws a uniform random real in [0, b_i], compute the probability that every parent's value is less than both its children's values, modulo 1e9+7. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Cow DatingGiven probabilities p_i, choose a contiguous interval maximizing the chance that exactly one bull accepts, and print 10^6 times that probability rounded down. | Hard8 | MathTwo pointers+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dice and LaddersFind the minimum number of die rolls so that the probability of finishing a snakes-and-ladders board within that many rolls is at least p. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Hold or Continue?For each query state (Catelyn score, Hoster score, current turn total) decide hold or continue to maximize Catelyn's win probability when both play optimally in Pig to exactly 75. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Gnoll HypothesisGiven n spawn probabilities and a random pool of k chosen types, compute each type's expected effective spawn chance after unchosen chances shift to the next chosen type cyclically. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Expected ValueRepeatedly pick a random adjacent pair, replace the left value by its difference with the right, drop the right. Find the expected final value modulo 1e9+7. | Hard8 | Dynamic programmingProbability+2 | No attempts yet | 3s | 16 MB | Judgeable |
| Bus StopEach of n bus routes has independent waiting time uniform on [0, di]; find the expected minimum, output as a fraction modulo 998244353. | Hard8 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Nonsense TimeElements of a random permutation are unfrozen one at a time; after each unfreeze report the longest increasing subsequence length among the currently available elements. | Hard8 | Dynamic programmingBinary search+2 | No attempts yet | 12s | 512 MB | Judgeable |
| AlakazamGiven an array and range shuffle operations that permute a segment uniformly at random, answer point queries for the expected value at a position. | Hard8 | MathProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| QuicksortGiven a flawed quicksort with recursion depth limit k, find the expected number of inversions after running it on a uniformly random permutation of size n, times n! modulo 998244353. | Hard8 | CombinatoricsProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ExpEach of n independent monsters grants i experience (0 to k) with probability p_i, totals are capped at x, and the expected capped total must be computed modulo 998244353. | Hard8 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |