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 results2,994 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Box TopplingDecide if every standing box on an n by n floor can be toppled flat in some order and direction without leaving the floor or overlapping.Medium7BacktrackingBrute force+1No attempts yet1s128 MBJudgeable
PinballA ball falls straight down from x0 onto slanted segments, slides down each hit segment to its lower end, and the task asks for the final x coordinate.Medium7GeometrySorting+1No attempts yet1s128 MBJudgeable
TramEach boarding passenger takes the empty seat farthest from the nearest seated passenger in a 2-column tram, with ties broken by row then column.Medium7HeapSorting+2No attempts yet1s256 MBJudgeable
Intelligent Traffic SurveillanceReplay service logs to recover zone and exemption states and print one penalty ticket per vehicle-day with every violating photo.Medium7SimulationBinary search+2No attempts yet1s128 MBJudgeable
JawbreakRemove groups of at least 3 same-coloured connected balls to maximize the sum of squared group sizes plus a 1000 point clearing bonus.Medium7BacktrackingSimulation+1No attempts yet2s512 MBJudgeable
The Bessie ShuffleShuffle the top M cards with the given permutation, move the top card to a pile, repeat until empty, and report the card at each queried pile position.Medium7SimulationMathNo attempts yet1s128 MBJudgeable
The Bessie ShuffleRepeatedly shuffle the top M cards by a fixed permutation, deal the top card onto a pile, and report the labels at queried pile positions.Medium7SimulationMathNo attempts yet1s128 MBJudgeable
Airplane BoardingCows walk single-file to assigned seats and each blocks the line while stowing baggage, so compute the time until every cow sits.Medium7Segment treeSimulationNo attempts yet1s128 MBJudgeable
CATSGiven X, L and N, simulate the buggy two-stack counter program with global bit flips and output the number it prints.Medium7SimulationStack+2No attempts yet2s512 MBJudgeable
StrategyGiven the first two terms of the sequence where each next term is the absolute difference of the previous two, find the K-th term.Medium7Number theorySimulationNo attempts yet1s16 MBJudgeable
Cyclic MarathonRunners spaced around a circular track catch and eliminate the runner ahead, and the program prints the elimination order and the survivors.Medium7HeapLinked list+2No attempts yet3s256 MBJudgeable
FreightSchedule n freight trains over a single track with travel time s and one-minute departure gaps so the last train returns to Upper Bytown as early as possible.Medium7GreedySimulationNo attempts yet1s256 MBJudgeable
Blind Maze EscapeFind the shortest tilt sequence of at most 10 moves that exits the marble from every empty cell, breaking ties lexicographically.Medium7BFSGraph+2No attempts yet2s256 MBJudgeable
LanguagesGuess the language of each 100-symbol excerpt, learning online from the correct answer returned after every guess, and maximize accuracy over 10000 turns.Medium7SimulationImplementation+2No attempts yet10s256 MBJudgeable
Road WorkSchedule cars from both ends through one shared lane to minimize how many drivers wait past their patience limit.Medium7Dynamic programmingSimulationNo attempts yet1s512 MBJudgeable
Self-Intersecting PathCheck a robot path that moves forward and always turns right for any self-touching and report the longest valid prefix.Medium7GeometrySimulationNo attempts yet2s256 MBJudgeable
Zombie ApocalypseMove up to g people from the start across directed roads with entry limits and travel times to get the most to a hospital by time s.Medium7GraphSimulationNo attempts yet5s512 MBJudgeable
BanksFlipping a negative bank in a circle to positive takes the same amount from both neighbors; the goal is the fewest flips leaving every capital nonnegative.Medium7GreedySimulation+1No attempts yet5s256 MBJudgeable
UFOSimulate K laser shots that each remove the first R cells reaching one layer along a row or column, then find the P by P square with the largest remaining sum.Medium7Segment treeSimulation+2No attempts yet5s256 MBJudgeable
Path of Least PersistenceChange at most one square's jump so the walk from the top-left corner to the bottom-right corner is as short as possible.Medium7GraphShortest path+2No attempts yet3s256 MBJudgeable
MancalaFor each marble count N, print the pits of the unique Tchoukaillon board that sweeps every marble into the Roumba.Medium7MathSimulation+1No attempts yet1s256 MBJudgeable
Groundwater ReservesUniform rain fills a walled polygonal reservoir where each basin spills over its lower rim once full, and the task asks for the highest water surface reached.Medium7SimulationGeometry+1No attempts yet1s256 MBJudgeable
Can't stop playingStick each arriving power-of-two block to the left or right end, merge equal neighbours, and report if one block can remain with the smallest direction string.Medium7Dynamic programmingBit manipulation+2No attempts yet10s256 MBJudgeable
BilliardPredict which stationary ball a struck billiard ball hits first as it reflects off cushions over a path of length 10000.Medium7GeometrySimulationNo attempts yet8s256 MBJudgeable
Coding ContestPlace coders in the free starting slots so the queue contest that pairs the strongest and weakest of each front triple leaves the strongest possible survivor.Medium7Binary searchSimulation+1No attempts yet1s256 MBJudgeable
Revenge of the ants 1Ants march both ways around a circular rail and reverse on head-on meeting; find the first time every ant is back at its start with its initial direction.Medium7MathNumber theory+1No attempts yet5s256 MBJudgeable
CensoringRepeatedly delete the leftmost occurrence of any of N forbidden words from string S until none remains and print the result.Medium7String matchingStack+1No attempts yet1s256 MBJudgeable
Computer LabNew students each take the middle seat of the longest empty stretch, and each query asks where a given arrival sits.Medium7HeapDivide and conquer+1No attempts yet4s512 MBJudgeable
Trapped in the HaybalesBessie breaks any bale smaller than her running start, and you must find the cheapest single bale to enlarge so she never leaves the outer bales.Medium7Two pointersSorting+1No attempts yet1s256 MBJudgeable
BowlingCount the distinct bowling games whose frame symbols and running totals match the blurred notes.Medium7Dynamic programmingSimulationNo attempts yet1s256 MBJudgeable
SouvenirsBuy souvenirs from merchants in order with gold and silver coins and choose how to pay each price to maximize the number bought.Medium7Dynamic programmingGreedy+1No attempts yet1s256 MBJudgeable
Dragon curveReport the cursor position after the Xth drawn segment of the order N dragon curve generated by the given rewriting rules.Medium7RecursionDivide and conquer+2No attempts yet1s256 MBJudgeable
500-Yen SavingVisit shops in order, paying with held coins and bills, to collect the most 500-yen coins in change and spend the least for them.Medium7Dynamic programmingSimulation+1No attempts yet8s256 MBJudgeable
Monotone WalkwayGiven unordered cafe coordinates on an x-monotone orthogonal path from the origin, recover the visit order and report the coordinates of the queried positions.Medium7SortingGeometry+1No attempts yet5s256 MBJudgeable
Solving a 2×2×2 cubeGiven an unfolded 2x2x2 cube net, compute the fewest quarter turns that make each face a single color.Medium7BFSSimulation+1No attempts yet1s256 MBJudgeable
Rainbow ZamboniA zamboni paints cells on a wrapping grid while walking ever-longer legs that turn clockwise, and you print the final colors and resting cell.Medium7MathSimulation+1No attempts yet1s256 MBJudgeable
SolitaireGiven the starting deck order, compute the fewest redeals needed to move every card to the goal pile using the helper as ordered storage.Medium7SimulationGreedy+1No attempts yet2s256 MBJudgeable
Word by mouthSimulate the recursive WBM(m) vote, where faulty friends always forward cat, and report each loyal friend's majority word.Medium7SimulationDynamic programming+1No attempts yet3s256 MBJudgeable
TanksTrace a shot through a convex hull and inner boxes, applying face resistance and ricochets, and report pierced components and where it stops.Medium7GeometrySimulationNo attempts yet1s256 MBJudgeable
FygonGiven a short program of nested loops bounded by n, outer loop variables, or small constants, output the exact count of lag executions as a polynomial in n.Medium7MathCombinatorics+2No attempts yet2s256 MBJudgeable
Jelly RaidGuide the child from the bed to the fridge in the fewest turns while dodging patrols that catch anything sharing a clear row or column.Medium7BFSSimulation+2No attempts yet1s256 MBJudgeable
Falling BlocksPlace a repeating sequence of pentomino pieces on a 3 by 10 board with Tetris drops and row clears to maximize the count, or report forever.Medium7GraphDFS+2No attempts yet4s256 MBJudgeable
GodzillaGuide mechs across open and ruined blocks to reach a clear row or column shot at Godzilla on his fixed path with the fewest homes destroyed.Medium7BFSSimulation+1No attempts yet2s256 MBJudgeable
PLAY in BASICGiven a Music Macro Language score, find the character length of the shortest score with identical pitches, note lengths, volumes, and rests.Medium7Dynamic programmingSimulation+1No attempts yet5s512 MBJudgeable
JAG-channel IIFind the lexicographically smallest member posting order consistent with the recorded top-to-bottom thread picks under move-to-front reordering.Medium7BacktrackingSimulation+1No attempts yet3s256 MBJudgeable
Sprinkler layoutSara tiles her fenced farm with tromino sprinklers around scarecrows using at most as many fence holes as fields.Medium7ImplementationSimulation+2No attempts yet1s128 MBJudgeable
WateringTile each 5x5 field with tromino sprinklers following the snake-order procedure and label them greedily with letters a to z.Medium7BacktrackingImplementation+2No attempts yet1s128 MBJudgeable
Iceberg OrdersSimulate an order book with iceberg orders that match by best price then priority and refresh visible tips until each incoming order fills or rests.Medium7SimulationHeap+1No attempts yet1s256 MBJudgeable
Being Solarly SystematicSimulate planetoids moving on a wrapping 3D grid and merging on shared cubes until no more collisions occur, then report the final planets.Medium7SimulationNumber theory+1No attempts yet1s256 MBJudgeable
Endor ChameleonsChameleons walk a stick of length L, reverse and recolor on collision, and the total distance walked in each of K colors is reported.Medium7SimulationSortingNo attempts yet1s64 MBJudgeable
The Table in the DreamCount table cells holding values in each query interval, where each row starts at its index and each next entry adds the reversal of the previous entry.Medium7SimulationSorting+1No attempts yet5s512 MBJudgeable
Space PirateChange one teleporter destination, walk K jumps from star 1, and count the landing star over all N squared rewires.Medium7GraphSimulationNo attempts yet2s512 MBJudgeable
Walking in JOI KingdomN walkers start at given points and move east or west at speed 1, stopping when they meet anyone, and the task asks the positions of Q of them at time T.Medium7StackSimulation+1No attempts yet2s512 MBJudgeable
Lights Out in the BarnFor each polygon vertex, walk clockwise until angles and edge lengths reveal the start, then report the worst extra distance versus the shortest exit path.Medium7String matchingSimulation+1No attempts yet2s512 MBJudgeable
Joy's TerritoryCount the unit squares with all four corners visited by repeating the same N-step walk for K days from each day's endpoint.Medium7GeometrySimulation+2No attempts yet1s256 MBJudgeable
Snake Game SimulationSimulate a snake that grows on checkerboard food on a wrapping board with timed turns and report its length after death or one billion steps.Medium7SimulationQueue+2No attempts yet5s512 MBJudgeable
Crane Truck (Large)Simulate a crane truck program with up to two flat loops on 240 circular cells with modulo-256 counters and count its moves before it halts.Medium7SimulationMathNo attempts yet120s512 MBJudgeable
Dijkstra (Large)Given a short string of i, j and k repeated X times, decide whether it splits into three nonempty parts that multiply to i, j and k under quaternion rules.Medium7MathSimulationNo attempts yet5s512 MBJudgeable
Minesweeper MasterPlace M mines on an R by C grid so one click on the top-left cell reveals every mine-free cell, or report that no such board exists.Medium7ImplementationSimulationNo attempts yet5s512 MBJudgeable
Hamiltonian CircuitInsert vertices one by one into a directed cycle in a tournament by the two given rules, and print -1 when no rule applies.Medium7GraphSimulationNo attempts yet1.5s512 MBJudgeable
Professor Normal (Small2)Simulate marble exchanges on an M by N grid where each child splits 12 marbles among live neighbors and children with few marbles drop out.Medium7SimulationGraph+1No attempts yet5s512 MBJudgeable
Out of gasYou roll down a hill with free brakes and must reach distance D as fast as possible without ever passing a lead car whose positions are given at sample times.Medium7GreedyMath+1No attempts yet5s512 MBJudgeable
Out of Gas (Large)Brake a car rolling downhill under gravity to reach distance D as fast as possible without ever passing the lead car.Medium7GreedyMath+1No attempts yet5s512 MBJudgeable
Tide Goes In, Tide Goes Out (Small)Find the earliest reach time to an exit on a height map where water falls 10 cm/s and each move takes 1 second when the exit square has at least 20 cm of water else 10 seconds.Medium7Shortest pathGraph+1No attempts yet5s512 MBJudgeable
Cruise Control (Small)Cars on two lanes hold fixed speeds and may change lanes freely, so decide if all can drive forever or report the latest moment a slowdown is forced.Medium7Brute forceSimulationNo attempts yet5s512 MBJudgeable
Cruise Control (Large)Decide whether cars with fixed speeds on a two-lane road can change lanes to avoid collisions forever, and otherwise report the latest safe time as a fraction.Medium7GraphSorting+2No attempts yet5s512 MBJudgeable
Yut Nori Board Check (Small)Decide whether the recorded throw sequence can produce the given board under the stated Yut Nori movement, capture, and shortcut rules.Medium7BacktrackingSimulation+1No attempts yet5s512 MBJudgeable
The Killer Word (Large)Choose the dictionary word that forces the most wrong letter guesses from a guesser who tries letters in a fixed order while ruling out inconsistent words.Medium7TrieSimulation+1No attempts yet5s512 MBJudgeable
Vanishing NumbersSort the given decimals by the round in which repeated middle-third deletion removes them, listing numbers that survive every round last in increasing order.Medium7MathSimulation+1No attempts yet5s512 MBJudgeable
Bacteria (Large)Given initially filled rectangles on a grid evolving by a north-west neighbor rule, compute the seconds until no bacterium remains.Medium7Dynamic programmingSimulation+1No attempts yet5s512 MBJudgeable
Making Chess Boards (Large)Repeatedly cut the largest alternating-color square, breaking ties by topmost then leftmost position, and report how many boards of each size result.Medium7Dynamic programmingSimulation+1No attempts yet5s512 MBJudgeable
Crossing the Road (Large)Find the minimum time for a pedestrian to travel across a grid of intersections where crossing depends on periodically timed traffic lights.Medium7Shortest pathGraph+1No attempts yet5s512 MBJudgeable
Apocalypse Soon (Small)On a grid of at most 5 by 5, simulate daily simultaneous attacks where each AI nation hits its strongest surviving neighbor, and choose one attack per day to survive as long as possible.Medium7SimulationGreedy+2No attempts yet5s512 MBJudgeable
How Big Are the Pockets? (Small)Walk a closed non-self-touching orthogonal path from run-length encoded moves and sum the area of pockets: cells outside the polygon with boundary both east and west or north and south.Medium7GeometrySimulation+1No attempts yet5s512 MBJudgeable
Mousetrap (Large Input)In the perfect Mousetrap deck of K cards, report the card value at each queried position.Medium7SimulationImplementation+1No attempts yet5s512 MBJudgeable
Spinner (Large)Given a circular row of R, G, B cells and a three-cell local update rule, count each color after K synchronous rounds with K up to 1e9.Medium7SimulationMathNo attempts yet1s256 MBJudgeable
What Really Happened on Mars?Simulate a real-time task scheduler under the priority ceiling protocol and print the finish time of each task.Medium7SimulationGreedy+2No attempts yet2s512 MBJudgeable
Block GameA ball launched at 45 degrees bounces off three walls of a grid; count how many distinct polyomino blocks its 45-degree path passes through the interior of.Medium7ImplementationGeometry+2No attempts yet1s128 MBJudgeable
Cubic ArtGiven a cube state and a move sequence, apply point updates that replace one move and print the resulting cube state after each update.Medium7Segment treeSimulation+2No attempts yet1s1024 MBJudgeable
New Hanoi TowerGiven three rods with up to 10 labeled disks, find the minimum number of moves to sort them so each rod holds only its matching disk type.Medium7BFSImplementation+2No attempts yet5s512 MBJudgeable
Special Unit CHSimulate a cart moving on a line with agents that board it, are shot, die, and revive, and report the cart's position at each query time.Medium7SimulationImplementationNo attempts yet2s64 MBJudgeable
Fairies' SorceryGiven M-1 recorded spells and the final arrangement, find the position and type of one missing spell cast by a specified fairy.Medium7SimulationImplementationNo attempts yet2s256 MBJudgeable
Arcade!Given a triangular grid of holes with per-hole bounce probabilities and payouts, compute the expected payout of one dropped ball.Medium7ProbabilityDynamic programming+2No attempts yet2s512 MBJudgeable
DungeonA hero moves on a small grid while rectangular traps slide and freeze at the walls; find the earliest time to reach the exit without ever standing on a trapped cell.Medium7BFSSimulation+2No attempts yet2s512 MBJudgeable
Animal Companion in MazeGiven a directed room graph, find the longest walk where George never immediately reverses the door he just used, or report Infinite if he can walk forever.Medium7GraphSimulation+1No attempts yet2s512 MBJudgeable
Marble EscapeA board holds a red marble, a blue marble and one hole; tilting slides both marbles at once, and you must decide whether the red marble can drop into the hole within 10 tilts without the blue marble falling in.Medium7BFSSimulation+1No attempts yet2s512 MBJudgeable
Endless TurningSimulate a scooter rider who turns right at every intersection, and report her road after N turns or when she exits the city.Medium7GeometrySimulation+1No attempts yet2s512 MBJudgeable
Easy ReadingGiven a book text and a picture of painted cells, find the shortest prefix-contiguous text segment whose pen strokes draw exactly that picture up to translation.Medium7String matchingHash map+1No attempts yet2s256 MBJudgeable
Sand Tiger SharkSimulate a daily cannibalism process where each embryo eats the largest living embryo below it, and find the latest day embryo m can survive by choosing its meals.Medium7SimulationGreedy+2No attempts yet2s512 MBJudgeable
A Midsummer Night's DreamSimulate sightings and potion timings to determine who each dosed person first sees, then count mutual pairs.Medium7SimulationImplementation+2No attempts yet2s512 MBJudgeable
Mysterious MazeA robot in a grid moves forward or turns according to a fixed sequence of turns; decide whether it can reach the exit once the turns run out.Medium7BFSSimulation+2No attempts yet8s512 MBJudgeable
Dungeon Quest IIGiven a fixed walking route through a grid of traps and up to 12 one-use potions, decide whether the agent can survive to the end.Medium7Dynamic programmingBit manipulation+1No attempts yet8s512 MBJudgeable
OperatorSimulate callers who retry after hanging up, and find the fewest operators so all calls finish within time T.Medium7SimulationBinary search+2No attempts yet8s512 MBJudgeable
Robots' CrashGiven moving robots with two possible opposite velocities, find the earliest time any two centers come within distance 2r, or report SAFE.Medium7GeometrySimulation+1No attempts yet8s512 MBJudgeable
Cairo CorridorEach tile is split into two pentagon halves; find the connected clear region touching all four borders and decide whether it is minimal.Medium7GraphBFS+2No attempts yet2s512 MBJudgeable
Circle of LifeA circular binary strip updates so each cell is alive next generation only if exactly one neighbor is alive; find the state after T generations, with T up to 10^15.Medium7Bit manipulationMath+2No attempts yet2s512 MBJudgeable
Through a Maze DarklyA planar maze lists each room's neighbors in clockwise order; for each starting room, find the longest wall-following (right-hand rule) closed walk before returning to the start.Medium7GraphDFS+2No attempts yet2s512 MBJudgeable
AppleSimulate gravity, rotations, and waiting on a board with one apple, then print the final board state.Medium7SimulationImplementation+1No attempts yet1s128 MBJudgeable
Sorting with allowed swapsGiven a permutation and allowed swaps, decide if the given pairs can sort it and output the swaps produced by the described leaf-removal rule on the spanning forest.Medium7GraphDFS+2No attempts yet0.5s128 MBJudgeable
ZonesA diamond-shaped zone grows by extending one of four sides each step; output how many zones border each zone.Medium7ImplementationGeometry+1No attempts yet1s128 MBJudgeable