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
TitleLevelTopicsSolvedTime limitMemory limitJudge
Random Game~~~~~Output any integer between 1 and 2,147,483,647; the judge scores each of three runs by how close your number lands to a hidden random pick.Easy1MathProbability+2No attempts yet1s256 MBJudgeable
Rock Paper ScissorsCompare the two players' winning chances from their move probabilities and print who is more likely to win each match.Easy2ProbabilityMath+1No attempts yet1s128 MBJudgeable
Dice GameEach player rolls two dice with consecutive face ranges and the larger total wins, so compute both win probabilities from the four ranges.Easy2ProbabilityBrute forceNo attempts yet1s256 MBJudgeable
HeadshotAfter a click on a circular cylinder, compare firing at once against spinning first and print which choice is safer.Easy2ProbabilityStringNo attempts yet1s64 MBJudgeable
Suchan Is a Marine Boy!!Given N practice records, compute the ratio of their arithmetic mean to the expected value of a value drawn uniformly from them, or print divide by zero.Easy2MathImplementation+2No attempts yet2s512 MBJudgeable
LotteryGiven N, M, K, compute the probability that two random M-subsets of 1..N share at least K numbers using the hypergeometric distribution.Easy3CombinatoricsMath+1No attempts yet2s128 MBJudgeable
SmeechParse a prefix Smeech expression with probabilistic plus or minus operators and compute its expected value to two decimals.Easy3RecursionMath+2No attempts yet1s128 MBJudgeable
GymGiven an N by N matrix of card counts, compute the probability distribution over N baskets for the first 10 steps of a Markov process starting at basket 1.Easy3MathMatrix+2No attempts yet1s128 MBJudgeable
Four QuartersFor each round count from 1 to 20, compute the probability that A wins, B wins, or the game ties after that many rounds of this four-coin game.Easy3ProbabilityDynamic programming+1No attempts yet1s128 MBJudgeable
Bobby's BetDecide whether a bet pays off by computing the binomial chance of rolling at least R on at least X of Y rolls and comparing it to the odds W.Easy3ProbabilityCombinatorics+1No attempts yet2s256 MBJudgeable
Password RetypingGiven per-character correctness odds, pick backspaces or a restart to minimize expected keystrokes to finish the password.Easy3ProbabilityMath+1No attempts yet5s512 MBJudgeable
Commute War (Small)Walk the single chain of hourly rides from home to the office, adding each wait, ride time, and geometric checkpoint delay for the expected arrival time.Easy3ProbabilitySimulation+1No attempts yet5s512 MBJudgeable
World Cup BettingGiven N at most 10 matches with hit probabilities and odds, find the probability that a fixed-fraction bettor ends with more money than he started.Easy3ProbabilityBrute forceNo attempts yet1s32 MBJudgeable
Secret SantaFor a uniformly random permutation of N names, compute the probability that at least one resident draws their own name, rounded to 8 decimals; N can reach 10^12.Easy3ProbabilityMath+2No attempts yet2s512 MBJudgeable
Six SidesGiven the six faces of two dice, find the probability that the first die shows the higher value, ignoring ties by rethrowing.Easy3ProbabilityMath+1No attempts yet1s512 MBJudgeable
Vote (Small)Given N supporters of A and M of B, find the probability that A leads after every vote in a random arrival order.Easy3MathProbability+1No attempts yet5s512 MBJudgeable
What's Your Tier?Starting at 2000 points, play 20 games with given win, loss, and draw probabilities; compute the probability of ending in each of five tiers.Easy3ProbabilityDynamic programming+2No attempts yet2s256 MBJudgeable
ElectionGiven N total votes, M counted votes split as V1 and V2, and a threshold W, decide if the probability that candidate 1 wins (when each remaining vote is a fair coin) exceeds W%.Easy3ProbabilityMath+2No attempts yet1s512 MBJudgeable
Password HackingGiven each password's probability of being correct, find the expected number of attempts when trying passwords in the order that minimizes it.Easy3GreedySorting+2No attempts yet1s512 MBJudgeable
Good Day Bad DayGiven a two-state Markov chain's transition probabilities and a starting mood, compute the probability of each mood N days later and print each scaled by 1000.Easy3ProbabilityDynamic programming+2No attempts yet1s256 MBJudgeable
SoccerGiven per-interval scoring probabilities for two teams over 18 intervals, compute the probability that at least one team ends with a prime number of goals.Medium4ProbabilityMath+1No attempts yet2s128 MBJudgeable
Tournament WinnerGiven all pairwise win probabilities among 8 players in a fixed single-elimination bracket, compute each player's probability of winning the whole tournament.Medium4ProbabilityDynamic programming+2No attempts yet2s128 MBJudgeable
CouponsCompute the expected number of purchases needed to collect all N coupon numbers, printing the result as an integer or reduced mixed fraction.Medium4ProbabilityMath+1No attempts yet1s128 MBJudgeable
HeadshotGiven a circular string of loaded/empty chambers, decide whether shooting immediately or re-spinning gives a lower chance of firing given the previous chamber was empty.Medium4StringProbability+1No attempts yet1s128 MBJudgeable
Linear PachinkoFor each linear Pachinko string, compute the percentage chance that a ball dropped on a uniformly random character exits through a hole or off an end, truncated to an integer.Medium4SimulationImplementation+2No attempts yet1s128 MBJudgeable
Suit DistributionFor each pair (a, b), compute the probability that the opponents' a+b cards of one suit split a and b between them.Medium4CombinatoricsMath+2No attempts yet1s128 MBJudgeable
BlackjackGiven n decks and three visible cards, compute the probability that the player's two-card hand beats the dealer's two-card hand.Medium4MathCombinatorics+2No attempts yet1s128 MBJudgeable
IndomieEach of the N people ahead takes a uniformly random remaining item among rice, sugar, and Indomie (Indomie limited to S). Find the probability Indomie remains for Felix, as a percentage.Medium4ProbabilityCombinatorics+2No attempts yet1s128 MBJudgeable
DartboardGiven ring radii and Gaussian spread, compute the expected dart score with averaged sector values and triple and double rings.Medium4ProbabilityMathNo attempts yet1s128 MBJudgeable
DrinksTwo players alternately draw balls without replacement until the first red ball appears, and you compute the chance the first player draws it.Medium4ProbabilityDynamic programming+1No attempts yet2s256 MBJudgeable
Horn BlowingCompute the probability that the summed start-up delays of N vehicles with given discrete distributions total at most T seconds.Medium4Dynamic programmingProbabilityNo attempts yet2s256 MBJudgeable
Marketplace Board (Small)Free dice roll uniform faces while fixed dice stay put, and each cell scores from the longest equal run through it, so average the total over all outcomes.Medium4Brute forceProbability+1No attempts yet5s512 MBJudgeable
Ball collisionsGiven N balls on a line, each picking a direction at random, find the expected number of collisions within time T.Medium4ProbabilityBrute force+2No attempts yet2s512 MBJudgeable
Drawing PebblesGiven pebble counts per color, compute the probability that K randomly drawn distinct pebbles all share one color, printed to 10 decimals.Medium4CombinatoricsMath+2No attempts yet2s512 MBJudgeable
HamletGiven a DAG of plot states where each action gives a probability distribution over higher-numbered states, find the best expected value from state 1 and round it to two decimals.Medium4Dynamic programmingProbability+2No attempts yet3s512 MBJudgeable
DragsterGiven pairwise win probabilities and a binary elimination bracket, compute the probability that driver 1 wins the tournament.Medium4ProbabilityTree+1No attempts yet2s512 MBJudgeable
Match PredictionGiven win/draw/loss probabilities for all six matches among four teams, compute each team's probability of finishing in the top two.Medium4ProbabilityBrute force+2No attempts yet1s256 MBJudgeable
Yogurt Expiration DatePick k yogurts with maximum total amount, break ties by minimizing the chance at least one is defective, and print that incident probability as a percentage.Medium5GreedySorting+2No attempts yet2s128 MBJudgeable
Sevi GameGiven one roll of five dice, pick at least two dice to reroll so the expected score of a poker-dice scoring system is minimized, with ties broken lexicographically.Medium5ProbabilityBrute force+2No attempts yet2s128 MBJudgeable
Game, Set and MatchGiven the per-point win probability p, compute the probabilities of winning a tennis game, set, and match using the standard scoring rules.Medium5Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
Minimal BackgammonSimulate turn by turn probability mass over board positions (with lose-a-turn and go-to-start squares, and bounce-back overshoot rule) to find probability of reaching the goal within T turns.Medium5Dynamic programmingSimulation+1No attempts yet1s128 MBJudgeable
PlinkoGiven rigged Plinko boards with per-peg right-move probabilities, compute for each start and end column the number of distinct paths and the truncated percentage chance.Medium5Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
Great Geek Game-show 3000!Given a random permutation of N names, each contestant follows its cycle up to K steps; find the probability every cycle has length at most K.Medium5CombinatoricsMath+2No attempts yet1s128 MBJudgeable
Yes or No?Pick between l and r questions to answer Yes, maximizing the sum of per-question expected correct probabilities, and report the maximum expectation to two decimals.Medium5Dynamic programmingSorting+2No attempts yet1s128 MBJudgeable
SoccerCompute probability distribution of final scores after up to T seconds of a stochastic soccer simulation with passing, stealing, shooting, and absorbing states.Medium5ProbabilityDynamic programming+2No attempts yet2s128 MBJudgeable
MessageGiven error and succession probabilities for a Martian alphabet, find the most likely original word for each intercepted message using maximum likelihood.Medium5Dynamic programmingProbabilityNo attempts yet1s128 MBJudgeable
Hopeless CoachGiven past win, draw, and loss counts, find the probability that the team earns at least P points over the next N matches.Medium5Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
France '98Given win probabilities for every pair of 16 teams and a fixed bracket, compute each team's probability of winning the single-elimination tournament.Medium5Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
The Millionaire and the OrphansGiven three orphanages with fixed basket areas and children counts, compute the expected total gift value each orphanage catches as gifts are thrown in order.Medium5ProbabilityMath+1No attempts yet1s1024 MBJudgeable
Game DiceGiven up to 13 dice with various face counts and a target total, compute the probability of rolling exactly that sum, to five decimals.Medium5Dynamic programmingProbability+1No attempts yet1s128 MBJudgeable
FootballGiven pairwise win probabilities, find the team most likely to win a fixed single-elimination bracket of 2^n teams.Medium5Dynamic programmingProbability+1No attempts yet1s128 MBJudgeable
Chocolate WholesalerGiven n independent bars with individual surprise probabilities, find the probability that a carton has at least k surprises.Medium5ProbabilityDynamic programmingNo attempts yet1s128 MBJudgeable
Project staffingAssign at most n hired workers to m projects so the total expected profit from rewards, fines, and conditional wages is maximal.Medium5Dynamic programmingProbability+1No attempts yet1s128 MBJudgeable
ArcheryA ray from the origin fires in a uniform random direction, and the task asks the expected number of segments it pierces.Medium5GeometryProbabilityNo attempts yet1s128 MBJudgeable
The One Dollar GamblerStarting from one dollar, compute the expected capital after T fair coin bets of fraction F and round it to six decimal places.Medium5ProbabilityMathNo attempts yet1s256 MBJudgeable
Vampire DiceCompute the success probability of scoring at least y points from x exploding ten-sided dice where 8 to 10 score and 10 grants an extra roll.Medium5ProbabilityDynamic programmingNo attempts yet1s256 MBJudgeable
RobberiesPick a subset of banks that maximizes the stolen money while the combined capture probability stays strictly below the given limit.Medium5Dynamic programmingProbabilityNo attempts yet1s256 MBJudgeable
Combat OddsGiven N independent battles with win chance p, compute the chance that a losing run of at least L occurs.Medium5ProbabilityDynamic programmingNo attempts yet1s256 MBJudgeable
Not So RandomFeed X through N stages that each apply bitwise AND, OR, or XOR with K at given probabilities and report the expected final value.Medium5ProbabilityBit manipulation+1No attempts yet5s512 MBJudgeable
Not So Random (Large)N machines each apply AND, OR, or XOR with K at given probabilities, and the expected output after chaining them must be computed.Medium5Bit manipulationProbability+1No attempts yet10s512 MBJudgeable
Typewriter Monkey (Small)Find the expected leftover bananas, which is the maximum achievable count of the target word minus its expected count in a random length S string.Medium5ProbabilityBrute force+1No attempts yet5s512 MBJudgeable
Typewriter MonkeyFrom keyboard letter frequencies, subtract the expected overlapping occurrences of a target word in a random length-S string from the maximum possible count.Medium5ProbabilityString matchingNo attempts yet5s512 MBJudgeable
Password Problem (Large)Choose how many typed characters to keep or erase to minimize the expected keystrokes to finish a password with known per-character correctness odds.Medium5ProbabilityPrefix sum+1No attempts yet5s512 MBJudgeable
MazeBob moves through a multi-graph where each letter opens doors with that label; given the letter sequence, compute the probability he reaches room n, choosing uniformly among available matching doors.Medium5ProbabilityDynamic programming+2No attempts yet2s512 MBJudgeable
WindowPick a uniformly random axis-aligned subrectangle of an H by W grid; find the expected number of cells times 9, modulo 1e9+7.Medium5MathCombinatorics+2No attempts yet1s512 MBJudgeable
Spontaneous TripGiven flight counts between airports, find the most likely airport reached after exactly K random flights starting from ICN.Medium5ProbabilityDynamic programming+1No attempts yet3s256 MBJudgeable
EcologyCompute the probability that exactly M of N birds wear a tracker after D days of catching C random birds each day.Medium5Dynamic programmingProbability+1No attempts yet2s512 MBJudgeable
Fleecing the RaffleAdd k slips with your name to a box of n slips so the chance your name is drawn exactly once among p draws is maximized.Medium5MathCombinatorics+2No attempts yet2s512 MBJudgeable
Tri-duGiven two known card values, pick a third value from 1 to 13 that maximizes the chance of holding a winning triple or pair against one opponent.Medium5MathProbability+1No attempts yet1s512 MBJudgeable
VampiresGiven two life totals, a hit threshold and a fixed damage, find the probability that vampire 1 wins a turn-based drain fight.Medium5ProbabilityDynamic programming+1No attempts yet2s512 MBJudgeable
Vote (Large)Given N supporters of A and M of B in random arrival order, find the probability A leads after every vote; a ballot-problem computation.Medium5CombinatoricsProbability+2No attempts yet5s512 MBJudgeable
Core Training (All Cores)With K = N, the AI works only if every core succeeds; split U training units among cores to maximize the product of final success probabilities.Medium5GreedyMath+2No attempts yet5s512 MBJudgeable
Front NineGiven a clamped random walk on [0,h] with step probabilities, compute the expected area under the piecewise-linear terrain over n steps.Medium5ProbabilityDynamic programming+2No attempts yet6s512 MBJudgeable
Probability that the knight stays on the boardA knight on an N by N board makes K random moves, each of the eight directions equally likely; find the probability it is still on the board after K moves.Medium5Dynamic programmingProbability+2No attempts yet2s512 MBJudgeable
Code CollectionGiven N possible codes and target K distinct codes, compute the expected number of independent uniform draws needed to collect at least K distinct codes, with N up to 10^18.Medium6ProbabilityMath+1No attempts yet2s256 MBJudgeable
Random RobotGiven move probabilities for E, W, S, N and up to 14 steps, compute the probability that the robot's random walk visits no grid cell twice.Medium6Dynamic programmingBrute force+1No attempts yet1s128 MBJudgeable
Rock-Paper-ScissorsCompute, as a reduced fraction, the probability that Hangseung reaches K round wins before Dongju in at most N rounds of rock-paper-scissors with ties possible.Medium6Dynamic programmingProbability+1No attempts yet2s128 MBJudgeable
Dice Battle GameGiven a defender count, simulate probabilistic dice battles to find the minimum starting attacker count achieving at least 50% win probability.Medium6Dynamic programmingProbability+1No attempts yet2s128 MBJudgeable
Card GameGiven 9 piles of 4 cards, compute the probability that repeatedly removing a uniformly random matching-rank pair of top cards clears all cards.Medium6ProbabilityDynamic programming+1No attempts yet2s128 MBJudgeable
Choosing a PubSimulate probabilistic vote-following among n pubs (Pólya urn style) to compute exact final probability each pub wins, handling ties uniformly.Medium6Dynamic programmingProbability+1No attempts yet1s128 MBJudgeable
Winning the MatchCompute the probability that team A wins a best-of-K volleyball match given per-serve win probabilities and a serve-switching rule between rounds and games.Medium6Dynamic programmingProbability+1No attempts yet1s128 MBJudgeable
Random WalkGiven n steps with probabilities of moving left, right, or staying, compute the expected value of the maximum position reached.Medium6Dynamic programmingProbability+1No attempts yet10s128 MBJudgeable
Cover UpGiven per-digit candidate lists with known-candidate probabilities, compute the win probability when the contestant plays optimally.Medium6ProbabilityDynamic programming+2No attempts yet1s128 MBJudgeable
Up the AnteGiven per-round win probabilities, find the chance a capped martingale strategy shows a positive balance at some round from k through m.Medium6ProbabilityDynamic programming+2No attempts yet1s128 MBJudgeable
I'm Attacking the Darkness!Parse a dice expression with up to six dice and integer modifiers, then compute the reduced fraction of outcomes whose total meets or beats a target value.Medium6Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
Monkeys at TypewritersGiven per-letter and space probabilities, find the probability that a random key sequence terminates at its first space in one of the given words.Medium6ProbabilityTrie+2No attempts yet1s128 MBJudgeable
Orange BowlGiven plays with a yard gain and success probability, choose a sequence whose total gain reaches n yards while maximizing the product of probabilities.Medium6Dynamic programmingMath+2No attempts yet1s128 MBJudgeable
Shut the Box IIGiven open cards and a rolled total, pick the set summing to the total that maximizes the probability of shutting every card under optimal play, and report that probability.Medium6Dynamic programmingBacktracking+2No attempts yet1s128 MBJudgeable
Driving Out the PiggiesA bomb starts at city 1 of an undirected graph, detonates at each visit with probability P/Q and otherwise moves to a random neighbor; find the detonation probability for every city.Medium6ProbabilityGraph+2No attempts yet1s128 MBJudgeable
ChocolateFor C equally likely colors, after N draws where matching pairs are eaten, find the probability that exactly M colors remain on the table.Medium6Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
To bet, or not to betGiven a board of movement and skip instructions, compute the probability the chip reaches End within T turns and decide the bet.Medium6Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
SoccerGiven 16 teams, a fixed bracket, and pairwise win probabilities, compute each team's probability of winning the single-elimination tournament.Medium6Dynamic programmingProbability+2No attempts yet1s128 MBJudgeable
Fare DodgingA commuter mixes per-track tickets priced from shortest distances with free rides that risk expected fines to minimize the expected cost from start to end.Medium6Shortest pathGraph+1No attempts yet1s128 MBJudgeable
WimbledonCompute the expected match length in minutes from each player's chance of winning a game on serve under best-of-five tennis scoring.Medium6ProbabilityDynamic programmingNo attempts yet1s128 MBJudgeable
Colored Bead PlateRun up to 16 random bead drops and tilts on a 4x4 plate and report the probability that the final layout matches the target.Medium6ProbabilitySimulation+1No attempts yet2s1024 MBJudgeable
Expected Ultimate DamageThe champion casts the ultimate N times with random doubling or plus-one effects on attack and ability, and you compute the expected sum of their product.Medium6ProbabilityMathNo attempts yet1s256 MBJudgeable
Finding a LineDecide whether any single line passes through at least p percent of N given points.Medium6ProbabilityGeometry+1No attempts yet4s256 MBJudgeable
GG NO RE OMG CHEATZFind the fewest extra attacker units that lift the dice-battle win chance to at least 75 percent.Medium6Dynamic programmingProbability+1No attempts yet3s256 MBJudgeable
MonstersThree monster colors eat each other in a cycle when random mixed pairs meet, and you compute each color's chance to be the last one standing.Medium6ProbabilityDynamic programmingNo attempts yet2s256 MBJudgeable
MillionaireDecide after each correct quiz answer whether to quit or continue so the expected log utility is maximal, then convert that utility into a dollar amount.Medium6Dynamic programmingProbability+1No attempts yet2s256 MBJudgeable