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 results6,410 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Repetition-Free FormulaParse a Boolean formula that may repeat variables, determine if the underlying function is read-once, and if so print its canonical repetition-free formula.Hard8RecursionString+2No attempts yet2s64 MBJudgeable
Hardwood CuttingGiven a labeled grid board, compute the maximum number of pieces separable by straight guillotine-style cuts starting from exposed edges, accounting for pieces that interlock and cannot be separated.Hard8SimulationRecursion+2No attempts yet1s128 MBJudgeable
Term GeneratorParse a formula, convert it to a normal form by expanding nested sums and products according to given rewriting rules, then implement a cyclic generator that outputs requested numbers of terms, some possibly skipped without printing, based on huge signed counters.Hard8String matchingRecursion+2No attempts yet1s128 MBJudgeable
Proof GeneratorConvert a logical formula to a canonical disjunctive normal form using given rewrite rules, then cyclically output the k-th next satisfying terms under given axioms for a sequence of queries.Hard8String matchingRecursion+2No attempts yet1s128 MBJudgeable
Sliding Block PuzzleFind the minimum number of moves to slide a 2x2 king piece and 1x1 pawns through two open cells until the king reaches the frame's top-left corner.Hard8BFSGraph+1No attempts yet5s128 MBJudgeable
Palindromic DNADecide, given a cyclic DNA alphabet and palindrome constraints on many index subsets with a no-adjacent-change rule, whether a valid ±1/0 edit assignment exists.Hard8Union-findGraph+2No attempts yet3s128 MBJudgeable
Matrix CalculatorParse and evaluate a matrix expression language with block matrices, transpose, indexing, and modular arithmetic, printing each assignment's resulting matrix.Hard8RecursionMatrix+2No attempts yet1s128 MBJudgeable
Stopped WatchesGiven ambiguous watch hand readings under rotation and permutation, find the shortest time interval containing at least one valid candidate time for every watch.Hard8Brute forceSimulation+2No attempts yet1s128 MBJudgeable
Digits on the FloorGiven bar segments on a plane, reconstruct their connection graph with signed right-angle joints and count how many of each seven-segment-style digit shape (0-9) appears, ignoring shapes nested inside larger ones.Hard8GraphGeometry+2No attempts yet2s128 MBJudgeable
City Road MapBuild a graph from road segments with one-way restrictions imposed by perpendicular or angled sign segments, then find the unique shortest path between two points.Hard8Shortest pathGraph+2No attempts yet20s128 MBJudgeable
Colored Cube 8-PuzzleFind the minimum number of die-rolling moves (capped at 30, else -1) to reach a target arrangement of colored dice and blank cell on a 3x3 board, via state-space search.Hard8BFSSimulation+1No attempts yet1s128 MBJudgeable
Push-To TelescopeCompute azimuth and elevation of catalogue stars from two setup readings, using a rotating equatorial frame, and print them or NOT VISIBLE.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
Magical CraftingGiven binary crafting recipes with diamond costs, decide for each target string of glow stones whether it can be produced from 'A' and find the minimum diamond cost.Hard8Dynamic programmingGreedy+2No attempts yet5s128 MBJudgeable
Snake CubeGiven a snake cube flattened on a 15x15 grid as 27 labelled cells, fold it back into a 3x3x3 cube and print the lexicographically smallest of all valid layer arrangements.Hard8BacktrackingDFS+2No attempts yet1s128 MBJudgeable
Kingdom ReunionDecide whether three lists of points form simple polygons and whether the first two are disjoint with union equal to the third.Hard8GeometryImplementation+1No attempts yet1s128 MBJudgeable
KunaiNinjas on a huge grid throw kunai in four directions; kunai vanish when two arrive at the same point at the same instant, so count the squares any surviving kunai passes through.Hard8GeometryHash map+2No attempts yet3s256 MBJudgeable
Guess My WordGiven a corpus of words with distinct letters, decide for each corpus whether player A can always win the hangman-like game by secretly switching consistent words.Hard8Game theoryBacktracking+2No attempts yet2s256 MBJudgeable
Digging for OilPlace three non-overlapping K by K squares on an M by N grid of oil estimates to maximize the total sum covered, with the grid up to 1500 by 1500.Hard8Prefix sumDynamic programming+2No attempts yet2s128 MBJudgeable
Hexagon PerplexagonPlace 7 hexagon pieces in a flower so numbers match on all 12 shared edges, and report the unique valid arrangement.Hard8BacktrackingBrute force+2No attempts yet2s128 MBJudgeable
Square CountCount all axis-aligned squares whose unit tiles lie in the union of rectangular rooms, where adjacent rooms connect through centered doors.Hard8GeometryImplementation+2No attempts yet1s128 MBJudgeable
HexagramCount how many ways, up to rotation and reflection, the 12 given distinct numbers can be placed on the 12 vertices of a hexagram so all 6 lines share one sum.Hard8Brute forceBacktracking+2No attempts yet5s128 MBJudgeable
Billiard TableA billiard ball must bounce off the table cushions exactly N times before reaching a target point; find the minimum travel distance, with corners counting as two bounces.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
New HorizonsGiven a spherical planet, a throne position and height, decide which object tops rise above Yertle's horizon and print their names sorted alphabetically.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
PipesGiven a grid of pipe tiles that may be rotated by multiples of 90 degrees, decide whether the tiles can be oriented so that every internal border edge is covered by lines on both sides or neither side.Hard8BacktrackingDFS+2No attempts yet1s128 MBJudgeable
Stake Coordinate ReconstructionGiven squared side lengths of triangles connecting numbered stakes in counter-clockwise order, reconstruct integer coordinates of every stake, with the first three fixed.Hard8GraphGeometry+2No attempts yet1s128 MBJudgeable
Laurel CreekGiven a grid with stumps and logs, find the minimum number of moves (traverse, pick up, put down a log) to walk from start to end stump.Hard8BFSGraph+2No attempts yet1s128 MBJudgeable
Rocket StagesChoose a subsequence of stages, in order, with total mass at most 10000 kg and never negative net acceleration, to maximize the final burnout velocity.Hard8Dynamic programmingMath+2No attempts yet1s128 MBJudgeable
InfiltrationIn a tournament digraph, find the smallest set of vertices whose closed out-neighborhoods cover all vertices, and output the lexicographically smallest such set.Hard8GraphGreedy+2No attempts yet10s128 MBJudgeable
KeysGiven keys attached to rings where rings can link, find the minimum key operations, then ring operations, to split keys into two connected piles owned by two people.Hard8GraphGreedy+2No attempts yet1s128 MBJudgeable
Safe CompanySimulate a laser bouncing off / and \ mirrors on a huge grid, then decide whether one mirror inserted in a single empty cell can make the beam exit the bottom-right side, counting all such cells.Hard8SimulationImplementation+1No attempts yet5s256 MBJudgeable
Takeover WarsTwo firms alternate merging their own subsidiaries or absorbing a strictly smaller rival one; decide who wins the takeover war with optimal play.Hard8GreedySorting+2No attempts yet1s128 MBJudgeable
Secret ProjectFor each test case find the shortest (then lexicographically smallest) sequence of add-a and multiply-by-m operations mapping every input in [p,q] into [r,s], or report impossibility.Hard8BFSMath+2No attempts yet1s128 MBJudgeable
Chip DesignPlace the most widgets on an N x N chip so row counts equal column counts and no row or column exceeds A/B of the total parts.Hard8Dynamic programmingGreedy+2No attempts yet10s128 MBJudgeable
Coffee ShopsFor each query radius m, find the grid intersection reached by the most coffee shops within Manhattan distance m, breaking ties by smallest y then smallest x.Hard8Prefix sumGeometry+2No attempts yet5s128 MBJudgeable
MedalsDecide whether some weight vector of the form (1/n^j, 1/n^k, 1/n^l) with total medals n can make Canada's score strictly exceed every other country's.Hard8MathGeometry+2No attempts yet1s128 MBJudgeable
Structural EquivalenceGiven recursive type definitions with aliases and structs, group type names into the smallest set of lines where each line holds names that are structurally equivalent after full unfolding.Hard8Union-findGraph+2No attempts yet1s128 MBJudgeable
Magic BitstringsGiven a prime p, output the lexicographically smallest non-constant magic bitstring of length p-1, where each row of the modular index matrix must equal the string or its complement.Hard8Number theoryMath+2No attempts yet1s128 MBJudgeable
Brownie Points IIGiven points in the plane, Stan picks a vertical line and Ollie a horizontal line through it; find Stan's guaranteed score and the distinct best Ollie scores.Hard8SortingPrefix sum+2No attempts yet1s128 MBJudgeable
Great CircleGiven latitude and longitude of two cities in degrees and minutes, find the most northerly latitude on the great circle arc between them, or print undefined if it is not unique.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
Return of the JediGiven up to 10 non-overlapping circular trees in the plane, find the shortest path length around them from start to goal point, then divide by the speed of 200 miles per hour.Hard8GeometryGraph+2No attempts yet1s128 MBJudgeable
SubwayGiven distance, top speed, acceleration limit, and jerk limit, compute the minimum time to move a train between two stops.Hard8MathSimulation+1No attempts yet1s128 MBJudgeable
Hotter ColderAfter each move with a Hotter, Colder, or Same hint, compute the total area where the hidden object can still lie inside a 10 by 10 square.Hard8GeometryBrute force+2No attempts yet1s128 MBJudgeable
Maze EscapeFind the shortest fixed sequence of moves that forces escape from every possible free starting cell in an n x n maze, tie-broken lexicographically.Hard8BFSGraph+2No attempts yet1s128 MBJudgeable
SpaghettiDecide whether two labeled Fortran IV programs run the same sequence of statements for every input, ignoring unconditional gotos and labels.Hard8GraphImplementation+2No attempts yet1s128 MBJudgeable
Crypt KickerDecrypt each line of a substitution cipher so every word appears in a given dictionary, choosing the lexicographically smallest result, or mask the line if none exists.Hard8BacktrackingString+2No attempts yet1s128 MBJudgeable
Leaps Tall Buildings (in a Single Bound)Given a city skyline of buildings with widths and heights, find the lowest parabolic leap from ground to ground that clears every building, and print its peak altitude rounded to two decimals.Hard8GeometryBinary search+2No attempts yet1s128 MBJudgeable
Ritual CircleFind the smallest circle enclosing all companions with every Orc strictly outside, and report the squared radius as an exact fraction.Hard8GeometryBrute force+1No attempts yet5s128 MBJudgeable
LocksmithGiven up to three axis-aligned polygonal pieces that interlock without overlapping in area, count how many pieces can be separated by sliding pieces (translation only, no overlap) until a straight line splits that piece from the rest.Hard8GeometrySimulation+2No attempts yet1s128 MBJudgeable
This Can't Go On ForeverFor each modulus m up to 2^24, output the length of the Pisano period of the Fibonacci sequence modulo m.Hard8Number theoryMath+2No attempts yet1s128 MBJudgeable
Laser ShotFind two different-direction bouncing laser paths from the droid to the Jedi, each with at most n bounces, that minimize the difference of their lengths.Hard8GeometryMath+2No attempts yet1s128 MBJudgeable
Repair DepotsPlace at most c depots anywhere in the plane to minimize the largest distance from any of n bots (n at most 16) to its nearest depot, and print that distance to six decimals.Hard8Binary searchGeometry+2No attempts yet1s128 MBJudgeable
Rubik's CubeGiven a scrambled Rubik's Cube as an unfolded net and a sequence of up to 1000 face rotations, output the cube state after applying all rotations.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Coffin TilesFor each n, find the smallest number of tiles whose unordered factor-pair count equals exactly n, or report Too big above 1000000.Hard8Number theoryBrute force+2No attempts yet1s128 MBJudgeable
Honeycomb, Honeycomb, Me Want Honeycomb!Given intact unit-length hexagonal cell walls as line segments, count how many hexagons still have all six of their walls.Hard8GeometryHash map+2No attempts yet1s128 MBJudgeable
Barcode of JudgmentA barcode is a fixed 7x9 grid pattern placed somewhere in a binary image, possibly rotated; find all valid placements and decode the data bits, or report none or ambiguity.Hard8StringImplementation+2No attempts yet1s128 MBJudgeable
FiltrationParse a set of FIR filter equations, evaluate each filter's output stream in dependency order, and print the resulting samples.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Fill the CrosswordFill a crossword grid with a given word list so every slot holds a listed word exactly once and crossings match; also decide if no solution exists.Hard8BacktrackingTrie+2No attempts yet1s128 MBJudgeable
Core WarsSimulate 8000-cell Redcode MARS with three addressing modes and report which warrior survives or if they tie after 32000 steps.Hard8SimulationImplementation+1No attempts yet1s128 MBJudgeable
Jetpack Sniper 3000 Fragfest ExtremeFor each of several 10x10 height grids and four 3D points, decide whether a building blocks the segment from you to players A, B, and C.Hard8GeometryImplementation+1No attempts yet1s128 MBJudgeable
As the Crow FliesGiven a network of cities with lat/lon coordinates and flight legs, find the pair whose shortest route (sum of great-circle leg distances) is the largest.Hard8GraphShortest path+2No attempts yet1s128 MBJudgeable
Su-domino-kuComplete a 9x9 Sudoku grid in which 36 dominoes cover the empty cells and every distinct digit pair appears as exactly one domino.Hard8BacktrackingDFS+2No attempts yet2s128 MBJudgeable
Line & Circle MazeBuild a graph from intersections of line segments and circles, then report the longest shortest-path distance between any two connected junctions.Hard8GeometryGraph+2No attempts yet1s128 MBJudgeable
SlinkSolve a Slink (all-numbered Slitherlink) puzzle by repeatedly applying twelve local deduction rules, then print the resulting loop as ASCII art.Hard8SimulationImplementation+2No attempts yet1s128 MBJudgeable
Ink BlotsGiven up to 100 circles that pairwise either miss or cross at two points, count the connected white regions they carve out of the plane.Hard8GeometryGraph+2No attempts yet1s128 MBJudgeable
Bright BraceletArrange all octagons in a cycle so adjacent edges match in color, minimizing the total brightness at the joints.Hard8BacktrackingBrute force+2No attempts yet1s128 MBJudgeable
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
Hilbert CurveCount how many points the n-th Hilbert curve shares with a given horizontal segment whose endpoints are grid multiples of 1/2^n.Hard8RecursionDivide and conquer+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
The DoorsGiven up to 18 vertical walls, each with two doorways, find the shortest path from (0,5) to (10,5) inside a 10x10 square without crossing any solid segment.Hard8GeometryGraph+2No attempts yet1s128 MBJudgeable
FunhouseGiven a walled floor plan, choose rooms covering the least total area so that every entrance-to-exit route passes through a chosen room.Hard8GraphShortest path+2No attempts yet1s128 MBJudgeable
Stained GlassGiven up to 8 polyomino-like ASCII piece silhouettes, each flippable horizontally, decide whether translations of them exactly tile the hole silhouette.Hard8BacktrackingBrute force+2No attempts yet1s128 MBJudgeable
Selling CellsCompute the fraction of a large circle covered by at least one of up to 24 smaller circles whose centers lie outside each other's coverage.Hard8GeometryMath+1No attempts yet2s128 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
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
Line of SightGiven a house segment, a property-line segment, and horizontal obstruction segments, find the length of the longest continuous stretch of the property line from which the whole house is visible.Hard8GeometrySorting+2No attempts yet1s128 MBJudgeable
Unhappy NumbersCount numbers in [lo, hi] that never reach 1 under the digit-square-sum map; bounds go up to 1e18 so answers need digit DP over precomputed unhappy states.Hard8MathDynamic programming+2No attempts yet1s128 MBJudgeable
WallsChoose the minimum number of odd-coordinate vertical or horizontal walls so that every segment between two stations is crossed by at least one wall.Hard8GeometryGreedy+2No attempts yet5s128 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
The Red GemFor each test case, find the fraction of a circular platform's circumference from which an entire red disk is visible without any orange disk blocking the line of sight.Hard8GeometryIntervals+2No attempts yet1s128 MBJudgeable
Function OverloadingParse nested overloaded function calls; for each, determine whether resolution is unique, impossible, or ambiguous, counting ambiguity cases up to 1000.Hard8Dynamic programmingImplementation+2No attempts yet2s128 MBJudgeable
Supply MissionFind the minimum total time for a helicopter to visit every moving submarine in any order, land one hour at each, and return to base.Hard8Brute forceGeometry+2No attempts yet2s128 MBJudgeable
SoccerGiven a partial soccer schedule with at most 12 unplayed matches, find the best and worst final rank each team can still achieve. Ties share the same position.Hard8Brute forceImplementation+2No attempts yet2s128 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
Moving SticksGiven an arithmetic equation written in seven-segment digits, move exactly n segments so the equation becomes true, choosing the lexicographically smallest solution.Hard8Brute forceImplementation+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
ASCII ExpressionParse a multi-line monospace arithmetic expression into its syntax tree, then evaluate it modulo the prime 2011 with modular inverses for fractions.Hard8ImplementationRecursion+2No attempts yet1s128 MBJudgeable
Tighten Up!Given a polygonal string between two holes and a set of pins, compute the length of the taut chain that wraps around the pins when pulled tight.Hard8GeometryGreedy+2No attempts yet1s128 MBJudgeable
Roll a Big BallFind the largest radius of a ball that rolls along a straight course without hitting any axis-aligned rectangular block.Hard8GeometryBinary search+2No attempts yet1s128 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
Enemy DivisionDivide soldiers into the fewest groups so that each soldier shares a group with at most one enemy, where every soldier has at most 3 enemies.Hard8GraphGreedy+2No attempts yet1s128 MBJudgeable
ConnectionPlace two vertex-disjoint grid paths on an N x M lattice, one joining A1 to A2 and the other B1 to B2, to minimize the total number of unit segments.Hard8GraphShortest path+2No attempts yet1s128 MBJudgeable
Polyomino PowersGiven a polyomino on a grid up to 10x10, find the smallest k in 2..5 such that the shape is tiled by k translated copies of one smaller polyomino, or report none.Hard8Brute forceBacktracking+2No attempts yet1s128 MBJudgeable
DinnerGiven a complete graph on n vertices with edge years (default 2008), find the smallest year Y such that vertices split into two parts of size at most 2n/3, one with all edges before Y, the other with all edges at or after Y.Hard8GraphSorting+2No attempts yet1s128 MBJudgeable
The Pythagorean TheoremGiven n, count ordered triples (a,b,c) with 1<=a<=b<=n-1 and c<=n-1 such that a^2+b^2 is congruent to c^2 modulo n.Hard8Number theoryMath+2No attempts yet1s128 MBJudgeable
Circle of DebtGiven three people's debts and the exact bills and coins each holds, find the minimum number of pieces that must change hands to settle all debts.Hard8Dynamic programmingBacktracking+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