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 |
|---|---|---|---|---|---|---|
| Hovering HornetExpected number of spots on a die visible from a random point in its box, counting a spot only when the segment to the viewer misses the die. | Medium6 | GeometryProbability+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Rigged RouletteChoose integer bets within a budget on roulette numbers so the rigged wheel favors the least-bet numbers and expected profit is as large as possible. | Medium6 | ProbabilityMath+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Falling Diamonds (Small)N diamonds fall onto a pile and slide left or right at random, and you compute the probability that one stops exactly at the given spot. | Medium6 | ProbabilitySimulation+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Google Royale (Small)Compute the best possible chance of growing A dollars to V dollars with capped doubling bets and report the largest opening bet that reaches it. | Medium6 | Dynamic programmingProbability+1 | No attempts yet | 10s | 512 MB | Judgeable |
| Dice Game Win ProbabilityA token moves on states 0 to N, stepping down with probability Q/P and up otherwise; find the probability of ending at N and print it modulo 1e9+7 as a reduced fraction. | Medium6 | Dynamic programmingProbability+1 | No attempts yet | 1s | 512 MB | Judgeable |
| RobotCompute the expected squared distance from the origin after a robot takes N probabilistic left, straight, or right moves, and print it as a fraction modulo 1e9+7. | Medium6 | ProbabilityMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Rabbit MovementGiven a colored board of at most 17 cells, simulate rabbits that move, collide, and shrink the board, then compute the expected number left from a uniformly random start. | Medium6 | SimulationCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dice and CandiesFind the expected number of throws of a fair six-sided die until the running sum reaches at least N, and print the value to six decimals. | Medium6 | Dynamic programmingProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Torus SeaOn a torus of size N by M, a random walk moves diagonally each day; find the expected number of days to first reach (x, y), or -1 if unreachable. | Medium6 | ProbabilityGraph+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Flipping CoinsEach step flips a uniformly random set of A_i coins; find the expected number of heads after all K steps. | Medium6 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Kangho's InvitationsGiven each friend's single disliked friend, find the expected number of friends who accept when a uniformly random invitation order is used. | Medium6 | ProbabilityMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lost in the WoodsGiven an undirected graph, find the expected number of random-walk steps from node 0 until node N-1 is reached. | Medium6 | GraphProbability+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Lost in the NightOn a tree, a walker starting at node A repeatedly picks a uniformly random neighbor until reaching hotel B or C; find the probability of hitting B first. | Medium6 | ProbabilityGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tournament WinsIn a random single elimination bracket of 2^k players, you are ranked r; find your expected number of wins. | Medium6 | ProbabilityCombinatorics | No attempts yet | 1s | 512 MB | Judgeable |
| Electoral CollegeGiven each state's win probability and electoral votes, find the probability that Jenabkhan gets more than half of the total electoral votes. | Medium6 | Dynamic programmingProbability | No attempts yet | 2s | 512 MB | Judgeable |
| Dice BettingCompute the probability that at least k distinct values appear when an s-sided die is rolled n times, and print it to nine decimals. | Medium6 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Vitcoin Lottery at Moloco (Easy)Order n tickets with prizes w_i and continuation probabilities p_i to maximize the expected sum of collected prizes, breaking ties by the lexicographically smallest permutation. | Medium6 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Left-Right-WinFor players seated in a circle, compute how much of a $100 pot each should pay, given the spinner probabilities of moving left, moving right, or winning. | Medium6 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Deceptive DiceGiven an n-sided die and at most k rolls, find the maximum expected final score when you may stop rolling at any point. | Medium6 | Dynamic programmingProbability+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Pass the BuckGiven a graph where each holder moves to a random neighbor or wins with probability 1/(d+1), find the win probability of a target player from a given start. | Medium6 | ProbabilityGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Valentine's DayChoose a subset of n presents, each independently causing happiness with probability Pi, to maximize the probability that exactly one present causes happiness. | Medium6 | ProbabilityGreedy+2 | No attempts yet | 2s | 512 MB | Judgeable |
| RainsGiven a grid of regular N-gons with side S and a brain of radius R, find the probability a random brain center lands close enough to a thread to be cut. | Medium6 | GeometryProbability+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Keys in BoxesGiven a uniformly random permutation of N keys among N locked boxes, find the exact probability that M bombs suffice to open every box, as a reduced fraction A/B. | Medium7 | CombinatoricsProbability+2 | No attempts yet | 2s | 128 MB | Judgeable |
| DartsCompute win probabilities up to score 501 for two darts players with different throw distributions, where B optimizes target section each turn. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| So You Want to Be a 2ⁿ-aire?A contestant with a current prize faces n questions; each question's success chance p is uniform on [t,1]. Find the optimal expected prize, to three decimals. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PracticeGiven pairs (n, w), fit a logistic regression by maximizing the product of per-observation likelihoods and report the slope and intercept to four decimals. | Medium7 | MathProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dumb BonesGiven the chance that each placed domino tips left or right, find the minimum expected total placements needed to finish a run of n dominoes. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Coin TossGiven a grid of m by n tiles of side t and a coin of diameter c, compute the percentage chance the coin covers exactly 1, 2, 3, or 4 tiles when its center lands uniformly at random in the rectangle. | Medium7 | ProbabilityGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fixing the BugsWith B bugs, T hours, and a failure factor f, choose each hour's bug by dynamic programming to maximize the expected total severity fixed. | Medium7 | Dynamic programmingProbability | No attempts yet | 1s | 128 MB | Judgeable |
| Random WalkingFor each graph, decide whether every bit position in every one of k random walk outputs has a 1-probability strictly between 25% and 75%. | Medium7 | GraphProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| EvolutionGiven N DNA strings linked in an unknown parent-child order, compute each creature's probability of being the original ancestor. | Medium7 | ProbabilityBit manipulation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Random WalkParse a small random program with procedures and threshold IF/GOTO or PROC commands, then compute each requested procedure's expected running time to three decimals. | Medium7 | ProbabilityGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| FamilyCompute the expected percentage of genes shared by pairs of monsters in a given family graph where each child inherits each gene from one parent at random. | Medium7 | GraphDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Single-Player GamesGiven mutually recursive game-tree definitions, find each identifier's expected score under uniform random play, or report it undefined when the game may never end. | Medium7 | ProbabilityMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Another LotteryEach of n players buys tickets across m rounds; round j pays 2^j to one random ticket. For each player, print the reduced fraction for the probability of winning strictly more money than everyone else. | Medium7 | ProbabilityMath+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Snowball FightGiven fixed alternating throwing order and hit probabilities, players choose targets to maximize their team's win chance; compute win and draw probabilities under optimal play. | Medium7 | Game theoryProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Collecting BugsFind the expected number of days until a stream of random (category, subsystem) pairs has covered all n categories and all s subsystems. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 2s | 64 MB | Judgeable |
| KeyFind every odd K in [A, B] such that (K-1)! is not a multiple of K^2, where B - A is at most 100 but B can be 10^18. | Medium7 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bargain or No BargainGiven prize values and a budget M, decide whether optimal play maximizing expected log utility yields expected prize money above M. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Map GeneratorGiven N planets each edge appears independently with probability P, find the probability that the resulting random graph is connected. | Medium7 | Dynamic programmingCombinatorics+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Map Generator Returns (MG-II)Given N places and independent edge probability P, find the probability that the random graph on N vertices is connected. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The GoatCompute the expected area eaten when a goat is tied for k days to uniformly random stakes of length l, where overlaps depend on disk-pair geometry. | Medium7 | ProbabilityGeometry+2 | No attempts yet | 1s | 128 MB | Judgeable |
| DiceGiven n and k, find the number of ways n fair dice can sum to k, then output the integer part of 100 times that probability. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| TournamentCompute the chance that two named entrants meet in a knockout bracket with random seeding and even match odds. | Medium7 | ProbabilityTree+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cellular NetworkYou sort n cells by their probabilities and split them into w ordered zones to minimize the expected number of paged cells. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Do Not Disturb!Two people wander a graph at random each step, and you must find the expected time until both reach node C at once. | Medium7 | ProbabilityMatrix+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Goguryeo and the Crown PrinceGiven two different binary strings of equal length, compute the probability that the first appears before the second in fair coin flips. | Medium7 | String matchingProbability | No attempts yet | 1s | 128 MB | Judgeable |
| Probability ParadoxTwo players each pick a coin-flip pattern and the program computes the chance the first pattern appears before the second. | Medium7 | ProbabilityString matching+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Join two kingdomsTwo trees with up to 40000 nodes each are joined by one uniformly random cross edge, and you must output the expected diameter of the combined tree. | Medium7 | TreeSorting+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bonus CardsDmitry compares his chance of winning a seat when he enters with a double-slot card and with a single-slot card. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Card TrickGiven the cards on the observed hopping path, compute the chance that a random start among positions 1 to 10 ends on the same final card. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 128 MB | Judgeable |
| SuitcasesGiven n passengers, k belt suitcases with none yours, and misplacement chance p, compute the chance your suitcase missed the plane. | Medium7 | ProbabilityMath | No attempts yet | 1s | 128 MB | Judgeable |
| Slave to achievements 1Craft as many N-cost daggers as possible and reclaim 0-to-K chips per dagger until fewer than N remain then print each final remainder probability modulo 1e9+7. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 3s | 256 MB | Judgeable |
| Following FlowCompute the expected travel time from vertex 0 to vertex N when each step follows a uniformly random outgoing edge with its own crossing time. | Medium7 | ProbabilityMatrix+1 | No attempts yet | 1s | 8 MB | Judgeable |
| Bicycle picture puzzleThe program reads W, H, and S and prints the probability that a random scramble needs fewer optimal swaps than S. | Medium7 | CombinatoricsProbability+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Typing monkeyGiven per-letter probabilities and two words P and Q, compute the probability that P appears as a substring before Q does. | Medium7 | ProbabilityString matching+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Optimal ability loadoutChoose a subset of abilities with given trigger chances and damage values to maximize the expected damage of one attack under a random trigger order. | Medium7 | Dynamic programmingProbability | No attempts yet | 1s | 512 MB | Judgeable |
| RiskCompute the attacker win probability in a Risk battle with D-sided dice where the defender picks one or two dice after seeing the attack roll. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 2s | 256 MB | Judgeable |
| ARAM (Small)Decide when to spend a capped, regenerating reroll budget on fresh random champions to maximize the long-run share of games won. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Rigged RouletteSplit integer bets within budget B across 37 roulette numbers, where the ball lands on a least-backed number, to maximize expected payout minus cost. | Medium7 | GreedySorting+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Observation WheelRandom arrivals fill the free gondolas of a circular wheel, and you compute the expected total of the distance-based fares. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| The Number TrickGiven K observed subset products, find the most likely hidden multiset of N numbers from 2 to M under the given posterior score. | Medium7 | Brute forceCombinatorics+1 | No attempts yet | 5s | 1536 MB | Judgeable |
| Perfect GameFind the level order that minimizes the expected time to clear every level in one deathless run when any death restarts the run from the first level. | Medium7 | GreedyProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Perfect GameOrder the levels to minimize the expected total play time when any death restarts the run from the first level. | Medium7 | GreedySorting+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Breaking Windows (Small)M workers randomly reinforce K windows and N villains randomly throw one stone each, and the task asks for the probability that at least one window breaks. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Breaking Windows (Large)Compute the chance that random stone throws break at least one of K windows after random reinforcements raise their durability. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 30s | 512 MB | Judgeable |
| Market Board (Large)Free dice land on uniform random faces and each cell scores by the longest run of two to four equal faces covering it; find the expected total. | Medium7 | ProbabilityCombinatorics | No attempts yet | 5s | 512 MB | Judgeable |
| Champion Sort (Large)Find the minimum expected number of uniform shuffles of adaptively chosen positions needed to sort a permutation of 1 to N. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Year of More Code Jam (Small)Given T tournaments with fixed round offsets and N equally likely start days, compute the exact expected value of the sum of squared daily round counts. | Medium7 | MathProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| A Year of More ContestsGiven T tournaments with fixed round offsets, each starting on a uniformly random day among N, compute the exact expected sum of squared daily round counts. | Medium7 | ProbabilityMath+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Collecting CardsEach pack is a uniformly random N-subset of C card kinds; find the expected number of packs until all C kinds are collected. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| Collecting Every CardFind the expected number of booster packs to buy, each pack giving N distinct kinds, until all C kinds are collected. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Test Passing Probability (Small)With M submissions and Q questions of 4 choices each, find the maximum probability of answering every question correctly, learning only whether each submission passed. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 5s | 512 MB | Judgeable |
| FunfairPick and order k games from n so the expected final money is maximized, then report that value. | Medium7 | Dynamic programmingSorting+1 | No attempts yet | 2s | 512 MB | Judgeable |
| SpeedrunGiven per-road win probabilities, choose checkpoints to save at so the expected time to reach checkpoint n is minimized. | Medium7 | ProbabilityDynamic programming | No attempts yet | 8s | 512 MB | Judgeable |
| Rock Paper Scissors RankingGiven each contestant's probabilities for scissors, rock, and paper, find the probability that contestant 1 finishes in place K of the recursive elimination tournament. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| AbilityCompute the expected damage of one attack where abilities are tried in a uniformly random order without replacement until one fires, and output the fraction modulo 1e9+7. | Medium7 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| BitsGiven N bits and K odd random index toggles per operation after sorting, compute for each starting zero count the expected number of operations to reach all ones. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| CardsFind the probability that L random packs of N equally likely card types meet every demand D_i, output as a fraction mod 1e9+7. | Medium7 | Dynamic programmingCombinatorics+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Holiday RoadsOn a tree, each of M families picks one of the other N-1 cities uniformly and independently; find the expected number of roads used by every family. | Medium7 | TreeProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Lottery interestCompute Kangho's expected balance after C weekly lottery drawings, where each ticket (one per won) is equally likely to win J, and print the exact fraction. | Medium7 | ProbabilityMath+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Arcade!Given a triangular grid of holes with per-hole bounce probabilities and payouts, compute the expected payout of one dropped ball. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Random Sort 2Compute the expected number of random swaps the process needs to turn a given permutation of size up to 10 into increasing order. | Medium7 | ProbabilityDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The ResistanceGiven past mission teams and sabotage counts, choose Q players most likely to contain no spy and print that probability. | Medium7 | ProbabilityCombinatorics+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Just in TimeGiven N rooms where each room has one random outgoing tunnel, choose T in [2, N] maximizing the chance a walker starting in room 1 is not back in room 1 at time T. | Medium7 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Dinner BetGiven N balls, D drawn per round, and two size-C cards, find the expected number of rounds until one player completes their card. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Foreign PostcardsPlace postcards in random batches, flipping a batch when its top card is upside down, and compute the expected number left picture down. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| ProbabilityGiven probabilities of letters A to D, find the probability that an optimally played game fills a row of n cells in alphabetical order. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 1.5s | 512 MB | Judgeable |
| SegmentsGiven N vertical segments at increasing x, pick A on segment 1 and B on segment N uniformly; find the probability that chord AB crosses every segment. | Medium7 | GeometryProbability+1 | No attempts yet | 0.5s | 256 MB | Judgeable |
| Two BallsTwo balls move on a grid for T seconds with different random rules; compute the probability they collide, to 4 decimals. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 1s | 256 MB | Judgeable |
| ProficiencyGiven two counters with geometric service times, find the probability that all L1 people finish before all L2 people do. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Family Hotel (Large)Rooms fill by repeatedly picking a random adjacent free pair until none remain; find the probability that a given room ends up occupied, modulo 1e9+7. | Medium7 | ProbabilityMath+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Red Tape Committee (Large)Choose exactly K of N members, each with a known Yes probability, to maximize the chance that exactly half vote Yes. | Medium7 | Dynamic programmingProbability+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Card CollectingCompute the minimum expected time to collect all n cards, choosing when to trade d cards for a chosen card or play for a random pack. | Medium7 | Dynamic programmingProbability+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Coin tossingGiven head counts from tossing two coins whose head probabilities are independent uniform on [0,1], compute the probability that the first coin's probability is smaller. | Medium7 | ProbabilityMath+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Flipping CoinsGiven N coins all tails and exactly K fair tosses chosen adaptively, find the maximum expected number of heads at the end. | Medium7 | ProbabilityDynamic programming+1 | No attempts yet | 4s | 512 MB | Judgeable |
| Cactus graph edge removalDelete uniformly random edges one at a time from a cactus graph until it disconnects, and output the expected number of deletions to six decimals. | Medium7 | ProbabilityGraph+2 | No attempts yet | 1s | 512 MB | Judgeable |
| KDH, Son of the TyphoonOn a tree where every pair of vertices adds 1 traffic to each path edge, vertices survive independently with probability p; find the expected total traffic. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| LoL TournamentGiven a tournament bracket where each winner is renumbered, find which starting positions give the highest chance of winning all n-1 rounds with per-round win probability p. | Medium7 | GraphTree+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Lottery for Vitcoins at Moloco (Hard)Order the tickets to maximize the expected sum of prizes, where ticket i stops the lottery with probability 1 - p_i, and break ties by the lexicographically smallest permutation. | Medium7 | GreedySorting+2 | No attempts yet | 2s | 512 MB | Judgeable |