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
Fax RegionsGiven the width and run length encoding of a huge fax image, count the connected dark regions using 4-directional adjacency without expanding individual pixels.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Split WindowsGiven a preorder traversal of a split tree, draw the minimum-sized grid whose boundaries match the layout, applying proportional rounding at each split.Hard8TreeRecursion+2No attempts yet1s128 MBJudgeable
Edge DetectionGiven an image as run-length encoded runs, set each output pixel to the largest absolute difference from its 8 neighbors, and emit the result as runs.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Out of SightGiven a walled grid, your start, and the step-by-step routes of several robots, find the maximum number of turns you can survive without any robot seeing you along a row or column.Hard8BFSSimulation+2No attempts yet1s128 MBJudgeable
Crosswords InsiderGiven a list of words and a crossword grid template, decide whether each word can fill one run of empty cells and output the lexicographically smallest filled grid.Hard8BacktrackingSimulation+2No attempts yet1s128 MBJudgeable
Zoned OutSimulate clerks who union incoming forms with all their past outputs, apply checks and erasures, and report the final version clerk 0 sends.Hard8SimulationGraph+2No attempts yet1s128 MBJudgeable
GHOSTGiven a GHOST position and dictionary, decide whether the computer should challenge, add the smallest safe letter, or bluff.Hard8Game theoryTrie+2No attempts yet1s128 MBJudgeable
CosmoCraftDecide how to split income among workers, facilities, and army each turn so all attacks are survived and the final army is as large as possible.Hard8GreedySimulation+2No attempts yet1s128 MBJudgeable
Catching Shade in FlatlandGiven N disjoint circles inside a park, track a ray from a sun rotating around the origin and report the maximum total chord length cut through all trees over 1440 one-minute samples.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
PapaGiven consistent family relations, infer spouses, parents, children, and sexes, then answer yes, no, or unknown for kinship queries like niece or grandfather.Hard8GraphUnion-find+2No attempts yet1s128 MBJudgeable
WhenExecute a complete When program, an event-driven language with simultaneous Set assignments and a rotating active-clause scheduler, and print its output.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
National TreasuresGiven a grid of artifacts with bitmask critical points and cells already holding guards, replace some artifacts with hired guards so every remaining artifact has a guard on each of its critical points, minimizing hires.Hard8GreedyMinimum spanning tree+2No attempts yet1s128 MBJudgeable
Queue SortGiven a permutation in a queue and two auxiliary stacks, find the minimum number of bulk transfer operations to sort the queue into ascending order.Hard8BFSSimulation+2No attempts yet1s128 MBJudgeable
Driving an Icosahedral RoverGiven a triangular grid and an icosahedron that rolls face-over-edge, find the fewest rolls to reach trigon (x, y) with face n on the bottom.Hard8BFSSimulation+2No attempts yet3s128 MBJudgeable
Hexerpents of HexwampGiven a chain of up to 8 hexagon sections on a hex grid with rocks, find the minimum number of simultaneous legal moves to bring the head to a goal cell.Hard8BFSSimulation+2No attempts yet10s128 MBJudgeable
Water TankSimulate water filling a 100 cm tank divided by partition boards of distinct heights, with faucets pouring into regions, and report the exact water level at given positions and times as integers or reduced fractions.Hard8SimulationSorting+2No attempts yet1s128 MBJudgeable
JezzballGiven up to ten bouncing atoms, find the earliest time a horizontal or vertical ray from a fixed point can be drawn without any atom touching it.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
Link and Pop -- the Block GameSimulate Link and Pop: repeatedly remove the best matching pair (1, 2, or 3 segment link), let blocks slide by their attributes, and print the final board.Hard8SimulationImplementation+2No attempts yet2s128 MBJudgeable
The Rotation GameGiven a 24-cell board, find the shortest sequence of the eight line-rotation moves that makes the eight center cells show the same symbol.Hard8DFSBrute force+2No attempts yet1s128 MBJudgeable
The Pharaoh's CurseOn a small grid, S pushes up to two sarcophagi onto buttons while stepping around them, and must reach the exit with all buttons held; find the minimum steps or report impossible.Hard8BFSGraph+2No attempts yet5s128 MBJudgeable
Stealth NinjaGiven guards patrolling a grid with periodic vision, decide whether a ninja can walk from the front wall to the back wall unseen.Hard8GraphBFS+1No attempts yet1s128 MBJudgeable
FloodGiven a non-crossing grid-aligned wall network, determine which walls survive after water bursts outward-inward hour by hour until all regions flood.Hard8GraphBFS+2No attempts yet1s128 MBJudgeable
WarshipsEach warship is an axis-aligned or diagonal segment in an n by n grid; each horizontal or vertical laser shot removes all ships touching that line, and you report the heaviest weight removed per shot.Hard8GraphSimulation+2No attempts yet6s256 MBJudgeable
Polish FlagThree children grow regions of blocks from three fixed edges with priority rules and simultaneous expansion each turn; count each child's white (top) and red (bottom) cells.Hard8SimulationGeometry+2No attempts yet2s128 MBJudgeable
IciclesIcicles grow each hour when strictly longer than both neighbors and snap at length L; find the hour when all have broken.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Ladder GameGiven a ladder with n lines and m rungs, erase at most one rung to minimize the sum of scores reached from the leftmost k starting lines.Hard8ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Moving Cups Across Three TraysCups of sizes 1..n sit stacked (largest on top) on three trays; with moves allowed only between A-B and B-C, find the minimum number of moves to gather every cup onto A or C, or report -1 if more than m are needed.Hard8BFSDynamic programming+2No attempts yet1s128 MBJudgeable
Fence MakingFor each integer radius and spacing pair, count holes drilled through repeated remelting of the strip, then sum C(d,r,S) over all pairs.Hard8MathImplementation+2No attempts yet1s128 MBJudgeable
PetanqueSimulate seven petanque throws where a moving ball travels along its direction, possibly striking other balls and transferring its remaining roll, then decide who owns the closest boule to the coche and count points.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
Cutting EdgeGiven non-overlapping rectangles that tile a big pane, output the sequence of edge-to-edge cuts (smallest X1, then smallest Y1 first) that separates every rectangle.Hard8GeometrySorting+2No attempts yet1s128 MBJudgeable
Runner PawnsOn an 8x8 board with up to 8 pawns advancing one row per round, find the minimum knight moves to capture all pawns, or report impossible.Hard8BFSGraph+2No attempts yet1s128 MBJudgeable
MoversFor each box in order, decide whether it can be slid from the open left side to its destination without overlapping placed boxes or walls, and list the rejects.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
The Crayfish ScrivenerProcess type and undo commands, including nested undos, and answer queries for the character at a given position.Hard8StackTree+2No attempts yet2s512 MBJudgeable
Jousting TournamentGiven the starting order of N-1 knights and C fixed round intervals, find the smallest insertion position for a late knight with skill R that maximizes the number of rounds it wins.Hard8ArraySimulation+2No attempts yet1s256 MBJudgeable
Hill WalkGiven non-crossing slanted segments, simulate Bessie climbing each hill and falling straight down at its upper end, counting the distinct hills she touches.Hard8SortingBinary search+2No attempts yet1s128 MBJudgeable
Unlocking BlocksGiven three connected polyomino shapes on a small grid, find the minimum total number of unit slides that makes their bounding boxes pairwise non-overlapping, or -1 if impossible.Hard8BFSSimulation+2No attempts yet1s128 MBJudgeable
Cow TreatsSimulate a greedy process on a W by H grid where rows and columns may be swapped to place the highest remaining value in the earliest reachable slot.Hard8GreedySorting+2No attempts yet1s128 MBJudgeable
Holedox MovingFind the minimum number of moves for a snake of length up to 8 to slide its head to the exit at (1,1) on a grid with stones, where the tail cell counts as blocked during a move.Hard8BFSSimulation+2No attempts yet1s128 MBJudgeable
CheckersOn an N x N board, decide whether one king can capture every opponent checker in a single move of consecutive diagonal jumps, and print the unique landing sequence if so.Hard8DFSBacktracking+2No attempts yet1s128 MBJudgeable
Artificial LakeWater fills a terrain of N distinct-height platforms at 1 unit per minute; report when each platform first has 1 unit of water above it.Hard8StackSimulation+2No attempts yet1s128 MBJudgeable
Crazy BitsGiven initial and target 12-bit register values, find the minimum number of adjacent bit swaps (within and between registers) to transform one configuration into the other, or report impossibility.Hard8BFSSimulation+2No attempts yet1s128 MBJudgeable
Ball MachineSimulate a ball machine on a rooted tree: dropping balls follows a fixed priority path, and removing a ball makes balls above roll down; report resting node or number of moves.Hard8TreeSimulation+2No attempts yet1s128 MBJudgeable
Optimal ProgramsFor each set of input/output pairs, find the shortest stack-machine program of at most 10 commands made of ADD, SUB, MUL, DIV, and DUP, with lexicographically smallest ties.Hard8Brute forceDFS+2No attempts yet1s128 MBJudgeable
Fold-up PatternsGiven a planar net of unit squares with specified fold directions on shared edges, determine whether folding yields a closed surface of a solid and report its volume.Hard8GeometryGraph+2No attempts yet1s128 MBJudgeable
L-system SubstringGiven a D0L system over {a,b} and a query z, decide whether z appears as a contiguous substring of some word derivable from the start word.Hard8StringSimulation+2No attempts yet1s128 MBJudgeable
Lisa the Ladybug and the Broken CalculatorGiven a set of working calculator buttons, find the shortest sequence of presses that leaves target N on a display limited to 0..999.Hard8BFSImplementation+2No attempts yet2s128 MBJudgeable
Pyramid GuardsTwo guards walk opposite closed quadrilateral loops on a square pyramid's surface; find the minimum straight-line distance between them while they share a face.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
International Collegiate Programming ContestGiven the exact output of a banking simulator, rebuild the canonical input: map each result line to a fixed request and choose the smallest initial balance B that keeps every request valid.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Catch the Bus!Given bus routes with hourly timetables and two students' start times and stops, find the earliest moment they can meet at any shared stop, considering 2-minute transfer times.Hard8Shortest pathGraph+2No attempts yet1s128 MBJudgeable
Board GameTwo pieces move on a small board with holes; positions cannot repeat, so decide which player wins under optimal play.Hard8Game theoryGraph+2No attempts yet1s128 MBJudgeable
Request for PermissionGiven a convex country, M nearest-station Voronoi cells, and a straight flight segment outside the border, list the cells the flight crosses in order.Hard8GeometryBrute force+2No attempts yet1s128 MBJudgeable
Beware the GeoducksGiven two fixed walking routes on a weighted graph, decide whether the two travelers ever occupy the same point within t seconds, accounting for nodes with geoducks that make a traveler vanish.Hard8ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Origin of LifeGiven a 2D cellular automaton with parameters a, b, c, find the smallest number of steps from a Garden of Eden (a state with no predecessor) to the given state, or -1 if impossible.Hard8BFSSimulation+2No attempts yet1s1024 MBJudgeable
JengaismSimulate Jenga moves (remove a block, place it on top) and report when any structure topples because its center of gravity leaves the convex hull of its supports.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
SnailsEach of N snails moves in a fixed direction at speed 1 and stops at the fence, at any point an earlier snail crossed, or when it meets another snail simultaneously; find when the last snail stops.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
RobotsFind the minimum number of pushes to merge n robots (n <= 9) into one on a grid, where robots slide until blocked and plates turn them 90 degrees.Hard8BFSGraph+2No attempts yet2s128 MBJudgeable
Flooding FieldsGiven an n by n grid, k cows, and h hourly flood levels, find the maximum number of cows that can survive by moving each hour before the water rises.Hard8Dynamic programmingGraph+2No attempts yet1s512 MBJudgeable
Conditional StatementsParse a small nested if language, then for each checkpoint decide which variable assignments can reach it and print the forced true/false variables or unreachable.Hard8SimulationImplementation+2No attempts yet10s128 MBJudgeable
Obstacle CourseFind the minimum number of seconds to steer a sliding puck to a target on an ice rink, accelerating per second while avoiding integer-coordinate obstacles.Hard8BFSSimulation+2No attempts yet1s1024 MBJudgeable
Obstacle CourseTap a sliding puck to change its velocity and reach a target point in the fewest seconds without touching any axis-aligned obstacle stick.Hard8BFSSimulation+2No attempts yet2s1024 MBJudgeable
RocketFind, for each rocket, the minimum fuel so its total climb with velocity floor(K/(M+T))-g reaches at least the target height H.Hard8Binary searchMath+1No attempts yet1s1024 MBJudgeable
RobotsRobots on a circular track move clockwise for given durations, pushing each other and stopping at walls; find each final position.Hard8SimulationIntervals+2No attempts yet1s1024 MBJudgeable
Changing Phone NumbersGiven area codes and a sequence of rules (digit duplication, digit swap, area-code change) applied over time, answer queries transforming a phone number from one year to another.Hard8StringSimulation+2No attempts yet1s128 MBJudgeable
JaWsGiven two rows of equilateral triangles, drop the upper row onto the lower one and report where it settles or which side it slides off.Hard8GeometrySimulation+1No attempts yet1s128 MBJudgeable
The Willy Memorial ProgramSimulate water filling interconnected vertical pipes through links and find when the level in a target pipe is reached.Hard8GraphSimulation+1No attempts yet1s128 MBJudgeable
University Entrance ExaminationGiven students with scores, home regions, and program preference lists, plus program capacities, assign students to programs under a local-region priority rule and a fairness rule.Hard8ImplementationGreedy+2No attempts yet1s128 MBJudgeable
Museum Heist: Area of the Shadowy RegionsGiven an axis-aligned rectangle with non-overlapping rectilinear polygonal obstacles and a gun at the upper-right corner, find the total area of points no monotone beam can reach.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
RobotsSimulate a 31x31 robot game where robots chase you, applying a tie-broken greedy movement and teleport strategy to report whether you win or lose.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Statistical TroubleOutput each cross table of two survey questions as raw counts and rounded row and column percentages in a fixed 6-character grid.Hard8ImplementationMatrix+2No attempts yet1s128 MBJudgeable
Black BoxFind all 6x6 atom placements inside an 8x8 box that reproduce a set of laser entry and exit experiments, and report the layout if it is unique.Hard8SimulationBrute force+2No attempts yet2s1024 MBJudgeable
Key InsertionSimulate the recursive Insert operation on an infinite array for N keys and print the final occupancy up to the largest filled cell.Hard8Union-findImplementation+2No attempts yet1s512 MBJudgeable
Traveling QueenFind a shortest sequence of queen moves that visits every knight, then ends next to the bishop, and among shortest paths print the lexicographically smallest.Hard8BFSBit manipulation+2No attempts yet2s128 MBJudgeable
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.Hard8ProbabilityBFS+2No attempts yet1s128 MBJudgeable
Equilateral DominoesGiven up to 6 equilateral dominoes with pip values 1 to 6, tile a connected subset on the triangular grid to maximize shared edges between adjacent matching ends.Hard8BacktrackingGeometry+2No attempts yet15s128 MBJudgeable
Burns' RodsGiven the six colors on each of N slices plus both end caps, decide whether some sequence of 180-degree twists makes labels share a color exactly when they share a face.Hard8ImplementationSimulation+2No attempts yet1s128 MBJudgeable
The 2 x 2 x 2 Rubik's CubeGiven a scrambled 2x2x2 Rubik's cube, compute the minimum number of 90-degree turns needed to solve it.Hard8BFSSimulation+2No attempts yet10s1024 MBJudgeable
Road AccidentFind which quarter-part of each car (corner plus adjacent side halves) first touches the other car during straight-line motion before impact.Hard8GeometrySimulation+1No attempts yet1s128 MBJudgeable
Museum TourGiven a connected graph with max degree 3 and a fixed cyclic door order per room, count starting rooms whose edge-following walk eventually traverses every corridor.Hard8GraphSimulation+2No attempts yet1s512 MBJudgeable
AntsGiven a tree tour as a 2n-bit sequence, compute the exact time when the two ants walking in opposite directions turn around for the second time, as a reduced fraction.Hard8MathSimulation+2No attempts yet3s8 MBJudgeable
Bits GeneratorCount how many of the m possible seeds make a floor-mod pseudorandom generator output a given bit string of length n.Hard8MathNumber theory+2No attempts yet3s64 MBJudgeable
GatesEach gate outputs the majority state of its inputs (0, 1/2, or 1); decide for every gate whether its state is the same across all valid circuit states.Hard8ImplementationGreedy+2No attempts yet3s128 MBJudgeable
Assembler CircuitsGiven a straight-line program of register assignments, find the fewest binary-operation gates needed to compute all final register values for every initial state.Hard8Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Tetris AttackA stack holds each of n symbols twice; adjacent equal pairs vanish on contact, and one move swaps neighboring elements. Find the minimum swaps to empty the stack.Hard8GreedyStack+2No attempts yet1s128 MBJudgeable
Mirror TrapGiven a rectilinear polygon, pair up its corners by tracing 45-degree laser beams that reflect off mirror walls until each beam lands in another corner.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
LampGiven rectangular windows on two parallel walls 10 m apart and a lamp on one wall, count the windows of the lamp's building whose interior any reflected ray can reach.Hard8GeometryImplementation+2No attempts yet5s512 MBJudgeable
VouchersEach day k removes the a_k smallest remaining package sizes divisible by a_k; report which customers buy packages that hold vouchers.Hard8Number theoryMath+2No attempts yet3s128 MBJudgeable
Laser PoolA ball bounces elastically around a grid of lit horizontal and vertical laser beams; count how many distinct lit beams it touches during t time units, including the start.Hard8MathSimulation+2No attempts yet5s256 MBJudgeable
SupercomputerGiven jobs with arrival times and required processor-time, schedule them with preemption on a single 100% processor to minimize the sum of completion-minus-arrival times.Hard8GreedySorting+2No attempts yet1s128 MBJudgeable
ScreensaverA point moves diagonally and reflects off a set of disjoint horizontal and vertical wall segments; report its position after t seconds.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
Jasiek's DrawingGiven a counter-clockwise walk around a polyomino's border cells, count the total number of blackened cells in the drawing.Hard8GeometryImplementation+1No attempts yet1s128 MBJudgeable
KeyboardA 1x2 domino slides around a grid through the single uncovered cell; find the fewest moves to uncover every vowel cell at least once.Hard8GraphBFS+2No attempts yet1s128 MBJudgeable
Folding the MapDecide whether an n by m map with convex or concave creases folds to one square.Hard8SimulationDivide and conquer+1No attempts yet1s128 MBJudgeable
DamsEach of n sectors fills at its own rate behind dams of given heights, and you compute when water first spills past an end dam.Hard8HeapUnion-find+1No attempts yet1s512 MBJudgeable
Indiana Jones Among Zombies 2Choose the most disjoint rival pairs of zombies advancing on shortest paths to room 1 so each pair collides one step behind the other before reaching Indiana.Hard8GraphShortest path+2No attempts yet4s128 MBJudgeable
Block CompactionRepeatedly drop axis-aligned rectangles down and then left until none moves, and report the width and height of the final bounding box.Hard8SimulationGeometry+2No attempts yet1s128 MBJudgeable
KTX Train DepotFind the smallest number of straight tracks on which trains entering from either end before midnight can all leave toward their fixed ends on time.Hard8GreedySorting+1No attempts yet5s128 MBJudgeable
Straightening a bent wireDecide whether an axis-aligned wire can be straightened joint by joint from one end without ever touching itself during each unfolding.Hard8GeometrySimulationNo attempts yet1s128 MBJudgeable
Checkmate with Two RooksGiven a king and two rooks on a chessboard, find the fewest rook moves to force checkmate under optimal play, or 0 when mate is impossible.Hard8Game theoryBFS+1No attempts yet5s128 MBJudgeable
2D Solar SystemCircles tangent to one straight line glide with constant velocity, and the program reports when the first two touch.Hard8GeometrySorting+2No attempts yet1s128 MBJudgeable
Intuitionistic LogicGiven a DAG and its antichain algebra, test each formula over all variable assignments and report valid or invalid.Hard8Brute forceGraph+2No attempts yet2s128 MBJudgeable