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 results14,366 problems
TopicsJudge
Hanging HatsSimulate mages hanging triangular hats on a wall, tracking nail visibility and expulsion under coverage rules that require an advanced geometric data structure.Hard9GeometrySegment tree+2No attempts yet3s128 MBJudgeable
Gates of LogicParse an ASCII-art diagram of logic gates and wires with grid tracing rules (junctions, crossings, negation, ports) and compute values propagated to every named output.Hard9SimulationGraph+2No attempts yet1s128 MBJudgeable
Origami Axiom Six: Counting FoldsGiven two point-line pairs, count the distinct fold lines (common tangents of two parabolas) satisfying Huzita's sixth origami axiom for up to 20000 test cases.Hard9GeometryMath+1No attempts yet1s512 MBJudgeable
AsteroidsGiven two convex polyhedra, find rotations and a touching translation that minimize the distance between their centers of mass without overlap.Hard9GeometryMath+1No attempts yet1s128 MBJudgeable
Exclusive Access 2Given process-resource pairs, choose lock acquisition order per process to avoid deadlock while minimizing the longest alternating wait chain, over at most 15 resource labels.Hard9GraphCombinatorics+2No attempts yet1s128 MBJudgeable
Grand Theft Auto WheelGiven star-shaped polar polygons for a bolt hole and several wrench lugs, determine which wrenches can be inserted but cannot fully rotate inside the bolt hole.Hard9GeometrySimulation+1No attempts yet3s256 MBJudgeable
Fibonacci BaseGiven N up to 10^15, count how many '1' characters appear among the first N characters of the string formed by concatenating Zeckendorf (Fibonacci base) representations of 1,2,3,... in order.Hard9MathNumber theory+2No attempts yet1s128 MBJudgeable
Ground WorksSimulate water filling inside the region enclosed by a rotated Hilbert curve fractal against a tilted ground line, accounting for trapped air pockets, and output the flooded area to four decimals.Hard9GeometrySimulation+2No attempts yet3s256 MBJudgeable
K’ak’-u-pakal and the Maya ScriptParse a recursive grammar for Maya glyph compositions and render a minimal-size ASCII-art box layout respecting horizontal/vertical grouping and bracket-doubling size rules.Hard9RecursionString+2No attempts yet1s128 MBJudgeable
Fool's GameSimulate the full two-player card game 'Fool' with optimal play from both sides and determine which player ultimately wins.Hard9Game theoryDFS+2No attempts yet1s128 MBJudgeable
Room AssignmentsGiven n-1 inventors' two-choice coins forming a graph, pick an edge for the organizer's own coin that maximizes his expected room rating while keeping a perfect assignment possible.Hard9GraphUnion-find+1No attempts yet1s128 MBJudgeable
TantrixSimulate the hexagonal tile game Tantrix and count all legal placements of hand tiles given complex forced-space and controlled-side rules.Hard9SimulationGeometry+2No attempts yet1s128 MBJudgeable
Road PlannerGiven a DAG with linear latency functions per edge, distribute an integer number of cars from source to sink to reach Wardrop (selfish routing) equilibrium and output the floor of the equilibrium travel time.Hard9GraphMath+1No attempts yet1s128 MBJudgeable
RSA FactorizationGiven a huge n up to 10^120 and k, find primes p ≤ q with n = p*q and |q - kp| bounded by 10^5, requiring advanced factorization insight.Hard9Number theoryMath+1No attempts yet1s128 MBJudgeable
The Moon of ValenciaGiven a map of places with satisfaction values and walking edges, decide for each query whether a simple path between two nodes exists that fits a time budget and yields a satisfaction sum within 0.1 of a target.Hard9BacktrackingDFS+1No attempts yet1s128 MBJudgeable
Cubic ColoniesGiven a 3x3x3 arrangement of unit cubic blocks (some missing) and two surface points, compute the length of the shortest path on the colony's outer surface between them, allowing passage through zero-width edge or vertex gaps.Hard9GeometryGraph+2No attempts yet5s128 MBJudgeable
Periodic PointsCount periodic points of period n for a piecewise linear map on [0,m] modulo a given value, detecting infinite solution cases.Hard9MathGeometry+1No attempts yet2s128 MBJudgeable
Beneš Network RoutingGiven a required permutation between top and bottom computers of a recursively defined Beneš network, determine the lexicographically smallest sequence of switch settings that realizes it.Hard9Divide and conquerGraph+2No attempts yet1s128 MBJudgeable
Origami Through-HoleSimulate repeated paper folds with layered segments and reflection/overlap propagation rules, then count how many layers a pin punch pierces.Hard9GeometrySimulation+1No attempts yet1s128 MBJudgeable
Hobby on RailsGiven a grid of rotatable rail units including switches, find the maximum-length cyclic route through a switch over all valid layouts where every switch end connects to another switch.Hard9BacktrackingSimulation+2No attempts yet1s128 MBJudgeable
Lowest PyramidGiven an integer-coordinate base triangle, choose integer-coordinate apex points for its unfolded net so the folded tetrahedron has minimum positive height, or report impossibility.Hard9GeometryMath+1No attempts yet30s128 MBJudgeable
Polygons on the GridGiven up to six rod lengths, determine the maximum-area convex polygon whose edges are the rods with both endpoints on integer grid points.Hard9GeometryMath+1No attempts yet5s128 MBJudgeable
Crossing PrismsCompute the surface area of the solid formed by intersecting two identical prisms (one along the x-axis, one along the y-axis) whose cross section is a given simple polygon.Hard9GeometryMath+1No attempts yet1s128 MBJudgeable
Brainf**k InterpreterDecide whether a given Brainfuck program halts on its input and, if it loops, report the matching bracket pair that encloses the infinite loop.Hard9SimulationImplementation+2No attempts yet7s128 MBJudgeable
OutsourcingGiven two directed labeled graphs (factories) with start and final nodes, decide whether the two sets of label sequences realizable as paths from start to final are identical.Hard9GraphDFS+2No attempts yet1s128 MBJudgeable
Cheating or NotGiven g groups, seeded teams, pots, and confederation constraints, compute the average total strength of a given team's group opponents over all valid draws.Hard9CombinatoricsProbability+2No attempts yet1s128 MBJudgeable
Once You Shoot, You Cannot StopGiven board dimensions and bead counts per color, arrange beads and clear groups to maximize the sum of squared group sizes.Hard9CombinatoricsDynamic programming+1No attempts yet1s128 MBJudgeable
Protein IdentificationGiven peaks from an imperfect MS2 experiment, find the minimum number of noise peaks over all P/Q proteins whose total mass equals the largest peak.Hard9Dynamic programmingGreedy+2No attempts yet1s512 MBJudgeable
DNA SequencesGiven a DNA pattern with wildcards and a rank R, find the R-th lexicographic matching string that decomposes into at most K non-decreasing runs.Hard9Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
ZooChoose cages to empty on a circle so that the most children watching 5-cage arcs become happy, where each child needs one feared animal removed or one liked animal kept.Hard9Dynamic programmingBit manipulation+2No attempts yet2s128 MBJudgeable
Museum GuardsAssign each guard repeating daily intervals on half-hour boundaries within their availability and minute limits so the minimum number of guards on duty is maximized.Hard9Binary searchGreedy+2No attempts yet5s128 MBJudgeable
IdeasFor each directed tube, find the smallest set of ideas a packet must carry while traversing it so that every reachable person still receives all ideas they need.Hard9GraphDFS+2No attempts yet1s128 MBJudgeable
Nice PrefixesCount length-L strings over a K-letter alphabet where every prefix keeps all symbol counts within 2 of each other, modulo 1e9+7, with L up to 1e18.Hard9Dynamic programmingCombinatorics+2No attempts yet1s128 MBJudgeable
Asteroid RangersGiven n moving points, count how many times the minimum spanning tree over all future times changes, plus the initial build.Hard9Minimum spanning treeGeometry+2No attempts yet1s128 MBJudgeable
Old Factory PlumbingChoose a water height so the flooded region avoids open holes unless plugged or piped, minimizing pipe distances plus 0.5 per plug.Hard9GraphMinimum spanning tree+2No attempts yet5s128 MBJudgeable
Affine MessGiven three integer start points and three integer end points, decide whether a snapped integer rotation, integer scaling, and integer translation map one set onto the other, and if so whether all such maps agree on the whole plane.Hard9GeometryMath+2No attempts yet2s128 MBJudgeable
Mummy MadnessGiven mummy start positions on an infinite grid, compute how many time steps a fleeing player survives when both sides move on a king-step grid.Hard9Binary searchGeometry+2No attempts yet6s128 MBJudgeable
Jack and JillChoose walking routes and timing for two people on a grid so the smallest distance between them at any whole minute is as large as possible, and report that maximum.Hard9Binary searchBFS+2No attempts yet1s128 MBJudgeable
SpellcastingGiven element costs, power rates, and a support tree, find the minimum time for the spell's total power to reach the target, given starting energy and continuous accumulation.Hard9MathGreedy+2No attempts yet1s128 MBJudgeable
Cubic RubeGiven two connected 5x5 height maps of unit cubes, decide whether the pieces can be rotated and translated in 3D to assemble a full 5x5x5 cube.Hard9ImplementationGeometry+2No attempts yet1s128 MBJudgeable
A to Z NumeralsConvert each positive integer up to 7e17 into its unique A to Z numeral, where letters a to r and A to R stand for powers of ten and their quintuples.Hard9GreedyMath+2No attempts yet1s128 MBJudgeable
GuardPlace g guards on segments so every valuable point is seen, minimizing the largest value-times-distance risk, or report too few guards.Hard9GeometryBinary search+2No attempts yet1s128 MBJudgeable
Triangle CutsGiven a large triangle and four small triangles as angle triples in clockwise order, decide whether three straight cuts can produce exactly those four pieces.Hard9GeometrySimulation+2No attempts yet1s128 MBJudgeable
PotholesPlace a straight rope across a rectangular lot without crossing any pothole so the total pothole area is split as evenly as possible, with tie-breaking rules.Hard9GeometrySorting+2No attempts yet1s128 MBJudgeable
Planning Rolling BlackoutsPartition an h by w grid by recursive guillotine cuts so that the heaviest set of groups left powered stays within capacity, maximizing the group count and then the reserve.Hard9Dynamic programmingPrefix sum+2No attempts yet3s512 MBJudgeable
A Broken DoorGiven a grid maze with card-locked doors on some walls, find the fewest cards that always suffice to reach the exit whichever single door is broken, or -1 if some broken door cuts off the exit.Hard9GraphShortest path+2No attempts yet3s128 MBJudgeable
The Most Powerful SpellGiven a labeled directed graph, find the lexicographically smallest string that labels a walk from the star node to the gold node, or print NO if none exists or the minimum is unbounded.Hard9GraphShortest path+2No attempts yet5s128 MBJudgeable
Old MemoriesGiven pieces of an original text and an altered copy with at most d edits, list all original strings whose edit distance to the copy is at most d and where every position lies inside some piece occurrence.Hard9String matchingDynamic programming+2No attempts yet10s128 MBJudgeable
Congruent Partition of ChocolateGiven a connected polyomino of at most 36 unit squares, decide whether it splits into two connected pieces that are congruent under rotation, reflection, and translation.Hard9Brute forceDFS+2No attempts yet30s128 MBJudgeable
Twirl AroundA bar inside a simple polygon rotates clockwise, pivoting on the wall whenever a new contact point appears; report the final position of one end, or the position when it jams.Hard9GeometrySimulation+2No attempts yet1s128 MBJudgeable
KindergartenSplit n students into three classes so nobody keeps their old teacher and every classmate sits in each other's top T, minimizing T.Hard9GraphBinary search+2No attempts yet1s128 MBJudgeable
Around the TrackFind the Eulerian circuit of a planar-ish graph whose total turning cost is minimized, where each degree-4 node requires choosing how to pair its incident edges.Hard9GraphDynamic programming+2No attempts yet1s128 MBJudgeable
The Floor BricksCover a column-height profile of a bare floor with rotated 3x3 polyomino bricks of given prices, minimizing total cost.Hard9Dynamic programmingImplementation+1No attempts yet1s128 MBJudgeable
ASCII ArtRender triangles with ASCII characters, projecting 3D vertices through a camera onto an S by S screen grid with depth-based visibility.Hard9GeometryImplementation+2No attempts yet1s128 MBJudgeable
Navi NavigationGiven a weighted undirected graph with fruit types on nodes and multiple queries, find for each pair a shortest path that visits exactly one node of every fruit type.Hard9GraphShortest path+2No attempts yet1s128 MBJudgeable
Two Circles in a Convex PolygonFind the largest radius R so that two non-overlapping circles of radius R fit inside a given convex polygon with N vertices.Hard9GeometryBinary search+2No attempts yet4s128 MBJudgeable
Giant CoverGiven axis-aligned boxes on a rectangular campus, find the minimum surface area of a convex solid above the ground that covers all boxes and is anchored to the campus boundary.Hard9GeometryMath+2No attempts yet1s128 MBJudgeable
TablesCount the tilings of a polyiamond on a triangular grid by isosceles trapezoids made of three unit triangles, given the shape's boundary as a sequence of grid nodes.Hard9Dynamic programmingGeometry+2No attempts yet1s128 MBJudgeable
Farmer JohnGiven start, goal, and up to 100 disjoint line-segment fences, find the shortest path that cannot cross any fence, touching allowed, and print the length to six decimals.Hard9GeometryGraph+2No attempts yet1s128 MBJudgeable
ArcheryPlace Seungwon into one of 2N gaps so that after R tournament rounds his final target number is minimized, breaking ties by the largest starting target.Hard9MathSimulation+2No attempts yet1s128 MBJudgeable
TeleportersPlace up to M new teleporters between given endpoints so the forced eastward walk triggers as many teleports as possible.Hard9GreedySorting+2No attempts yet1s128 MBJudgeable
Amazing RobotsTwo robots in separate mazes receive the same direction command each minute; guards patrol back and forth, and you must find the minimum time until both robots exit without capture.Hard9BFSSimulation+2No attempts yet1s512 MBJudgeable
ContactGiven a binary string and a length range [A,B], report the N largest occurrence counts and all patterns achieving each count, with output ordering rules.Hard9StringSorting+2No attempts yet1s128 MBJudgeable
Success Probability of the Card-Pile GameGiven n decks of k cards each shuffled into n piles, find the probability that the follow-the-number drawing game succeeds within m restarts, printed to r decimals.Hard9ProbabilityCombinatorics+2No attempts yet1s128 MBJudgeable
Version-Controlled IDEMaintain a versioned text buffer under insert and delete operations, answering substring queries against any past version, with all commands encoded by a running counter.Hard9TreeImplementation+2No attempts yet1s128 MBJudgeable
Apparent Twin PrimesFor each query (n, t), find the smallest n-digit p such that neither p nor p+2 has a prime factor at most t.Hard9Number theoryMath+2No attempts yet1s128 MBJudgeable
Synnerg LifeformGiven rewriting rules that merge adjacent synnergs with multiplicative lifetimes, find all maximum-lifetime synnergs obtainable by fully unifying some contiguous block of each input sequence.Hard9Dynamic programmingIntervals+2No attempts yet1s128 MBJudgeable
Ballroom LightsGiven point lightbulbs and disjoint circular columns inside a rectangle, compute the total length of the wall perimeter that some lightbulb can reach with a straight, unblocked ray.Hard9GeometryMath+2No attempts yet1s128 MBJudgeable
JukeboxEach song has a title and artist; decide which artist fields to drop so the total length of shortest unique substrings over all title and remaining artist strings is minimized.Hard9StringBrute force+2No attempts yet3s128 MBJudgeable
Not Too Convex HullPartition the nails into B convex polygonal groups, all sharing the origin nail, minimizing the total covered area, with the origin strictly inside the global hull.Hard9Dynamic programmingGeometry+2No attempts yet1s128 MBJudgeable
The Ideal CityGiven N cells forming a simply connected polyomino with no holes, compute the sum of grid shortest-path distances over all pairs, modulo 1e9.Hard9GraphBFS+2No attempts yet1s256 MBJudgeable
Hyperspace RoutesFor each query, find every possible value of the shortest A-to-B path length as the shared hyperspace edge weight x ranges over the positive integers, then report the count and sum, or inf when unbounded.Hard9Shortest pathGraph+2No attempts yet5s64 MBJudgeable
Tropical GardenCount starting ponds whose deterministic non-backtracking walk (prefer the most beautiful unused-at-previous-step walkway) reaches pond P after exactly K steps, for many K.Hard9GraphSimulation+2No attempts yet5s256 MBJudgeable
Yin and YangOn a tree with each edge colored black or white, count paths that split at an internal vertex into two legs each having equal numbers of black and white edges.Hard9TreeDivide and conquer+2No attempts yet2s128 MBJudgeable
Island TravelsGiven a grid with N islands and shallow water, find the minimum total swim distance to visit every island, starting anywhere.Hard9GraphBFS+2No attempts yet1s128 MBJudgeable
Tied DownGiven a closed polygonal rope loop and up to 10 collinear posts on its left, find the smallest set of posts to remove so the rope can be pulled free to the right.Hard9GeometryGraph+2No attempts yet1s128 MBJudgeable
Simplifying the FarmGiven a weighted graph where each edge length occurs at most three times, find the minimum spanning tree weight and count distinct minimum spanning trees modulo 1e9+7.Hard9Minimum spanning treeUnion-find+2No attempts yet1s128 MBJudgeable
BottleneckGiven a tree of one-way paths toward field 1, each with a per-time-unit cow capacity, answer K queries for the most cows that can reach field 1 by time T.Hard9TreeGreedy+2No attempts yet1s128 MBJudgeable
Taking TurnsTwo players alternately take bales from a line, skipping any number of earlier bales; each plays optimally and takes the leftmost optimal bale. Find each player's total.Hard9Dynamic programmingGreedy+2No attempts yet1s128 MBJudgeable
Cow HopscotchChoose an outbound path of jumps (each at most K squares) and a return path that only lands on squares one less than an outbound square, maximizing collected values.Hard9Dynamic programmingSegment tree+2No attempts yet1s128 MBJudgeable
Largest FenceGiven N grid points with no three collinear, find the size of the largest subset whose points form the vertices of a convex polygon.Hard9GeometryDynamic programming+2No attempts yet2s128 MBJudgeable
CastingFor a convex polygon, count the vertex pairs whose connecting line splits it into two parts that can each be pulled out by translation.Hard9GeometryTwo pointers+2No attempts yet1s128 MBJudgeable
Watering the FieldsPlace 3-cell sprinklers on a fenced grid so every non-scarecrow cell is watered exactly once, choosing tracks and sprinklers by a fixed lexicographic rule.Hard9GreedySimulation+1No attempts yet1s128 MBJudgeable
Forgetful WaiterCustomers sit around a round table and pass pizzas left or right each turn; find the minimum number of turns until every pizza reaches the customer who ordered it.Hard9GraphGreedy+2No attempts yet1s128 MBJudgeable
Warez TestOn a grid of walls, boxes, and targets, find the shortest sequence of Jimmy's moves that pushes every box onto a target, breaking ties by the lexicographically smallest move string.Hard9BFSGraph+2No attempts yet1s128 MBJudgeable
Winmine (Minesweeper)Count the ways to place the remaining mines on the unrevealed squares so that every revealed number matches its adjacent mine count, modulo 1000003.Hard9Dynamic programmingGraph+2No attempts yet2s512 MBJudgeable
Very Boring HomeworkInsert N keys into a BST, lay out its ASCII drawing, and report up to 5 small rectangular fragments of the picture.Hard9TreeImplementation+1No attempts yet2s128 MBJudgeable
ServersGiven a weighted connected graph with server ranks at most 10, count for each server the vertices W such that no vertex closer or equally close has a larger rank, then sum.Hard9GraphShortest path+2No attempts yet1s128 MBJudgeable
City NavigationCompute the shortest legal right-hand-side driving distance between two driveways in a numbered grid city with some road segments missing.Hard9GraphShortest path+2No attempts yet1s128 MBJudgeable
PendulumSimulate an idealized pendulum swinging around point hooks on a wall and print the length of the periodic orbit it eventually settles into.Hard9GeometrySimulation+2No attempts yet1s128 MBJudgeable
Cyclic Antimonotonic PermutationsFor each n, output the lexicographically smallest permutation of 1 to n that is both antimonotonic (every middle element is a local min or max) and a single cycle when read as a pointer mapping.Hard9CombinatoricsMath+2No attempts yet2s128 MBJudgeable
Construct the Wall MazeGiven three wall lengths and a shortest-path string in a 6x6 grid, construct a valid maze consistent with it, choosing the lexicographically smallest answer.Hard9Brute forceBFS+2No attempts yet1s128 MBJudgeable
Mine the GradientGiven a grayscale grid, find the largest square subgrid whose values follow a vertical, horizontal, or diagonal uniform gradient, and report its area.Hard9Dynamic programmingImplementation+2No attempts yet10s128 MBJudgeable
Alea iacta estGiven a linear congruential generator, compute the maximum Yahtzee score over eleven rounds by choosing which dice to keep and which combination to score each round.Hard9Dynamic programmingSimulation+2No attempts yet2s128 MBJudgeable
The Herbalists' VillageGiven a friendship graph, decide whether it has a planar straight-line drawing where every vertex reaches infinity without crossing an edge.Hard9GraphGeometry+2No attempts yet1s128 MBJudgeable
DownpaymentGiven future monthly interest rates for m mortgage plans, binding periods, and switch penalties, find the schedule of plan choices that minimizes the total money paid, with debt rounded down each month.Hard9Dynamic programmingGreedy+2No attempts yet1s256 MBJudgeable
A Romantic Movie OutingMaintain a dynamic set of occupied seats across a huge theatre, answer queries for the combined field-of-vision inconvenience of two seats, and at the end find the minimum over far unoccupied seat pairs.Hard9Segment treeDynamic programming+2No attempts yet2s512 MBJudgeable
The Lights Going On and OffGiven a light grid, pushing the button beside row k XORs it with the row above; count how many distinct bottom-row patterns can result from any subset and order of pushes.Hard9Bit manipulationMath+2No attempts yet1s128 MBJudgeable
LandingGiven up to 100000 integer points, find the largest circle whose boundary passes through at least three points and whose interior contains none, and output R^2 as a reduced fraction.Hard9GeometryCombinatorics+2No attempts yet1s128 MBJudgeable
Move that Mouse AGAINGiven up to 50,000 axis-aligned rectangles in a fixed bottom-to-top stacking order, process 50,000 point clicks, printing the topmost window at each point and moving it to the top of the stack.Hard9Segment treeGeometry+2No attempts yet3s128 MBJudgeable