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
Rope and QueriesMaintain a string under up to 100,000 queries that cut a substring and move it to the front or back, and print single characters.Hard8Linked listImplementation+2No attempts yet0.3s512 MBJudgeable
Intersecting RectanglesGiven n axis-aligned rectangles with all x and y coordinates distinct, decide whether any two boundaries cross or touch. One rectangle fully containing another does not count.Hard8SortingSegment tree+2No attempts yet2s512 MBJudgeable
Ants on a CircleAnts move on a circle of N points, reversing on collision; for each query (P, X) find the earliest time point P has been visited at least X times.Hard8MathSimulation+2No attempts yet1s512 MBJudgeable
SEGWAYSimulate N riders over a 300 m track with three speed sections and accelerators granting 1 s/m boost for X mod 20 meters, where X counts riders strictly ahead, and print each finish time.Hard8SimulationImplementation+2No attempts yet1s512 MBJudgeable
Random Number GeneratorSimulate a quadratic-polynomial generator to build a grid, then find the path from top-left to bottom-right whose sorted values are lexicographically smallest.Hard8SimulationGreedy+2No attempts yet3s256 MBJudgeable
Shopping MallSimulate customers choosing the counter with the minimum total wait (lowest index on ties), then compute a weighted sum of membership numbers in the order customers leave.Hard8SimulationHeap+2No attempts yet1s512 MBJudgeable
Copy and Paste 2Simulate N copy-and-paste edits on a string capped at length M, tracking positions backward so the first K characters of the final string can be printed.Hard8ImplementationBinary search+2No attempts yet1s512 MBJudgeable
Dice YutnoriGiven 10 die rolls, move one of four pieces around a branching Yutnori board each turn and maximize the score collected from numbered squares.Hard8BacktrackingSimulation+2No attempts yet2s512 MBJudgeable
Just Passing ThroughGrid path from the west edge to the east edge moving east, northeast, or southeast, crossing exactly n passes, minimizing total elevation.Hard8Dynamic programmingMatrix+2No attempts yet2s512 MBJudgeable
Pairing SocksGiven a sequence of 2n socks, find the minimum number of moves to pair all socks using two stacks with three allowed operations, or report impossible.Hard8StackGreedy+2No attempts yet1s512 MBJudgeable
Max or MinGiven numbers on a circle and min/max operations over a value and its two neighbors, find for each x the least minutes to make all values equal x, or -1.Hard8ImplementationGreedy+2No attempts yet1s256 MBJudgeable
Ice CreamGiven a capacitated pipe network with a chocolate source, a vanilla source, and a mixing sink, find the maximum flow that reaches the sink with equal chocolate and vanilla amounts.Hard8GraphShortest path+2No attempts yet1s512 MBJudgeable
Hold or Continue?For each query state (Catelyn score, Hoster score, current turn total) decide hold or continue to maximize Catelyn's win probability when both play optimally in Pig to exactly 75.Hard8Dynamic programmingProbability+2No attempts yet2s512 MBJudgeable
Game of Falling BlocksSimulate a simplified Tetris game that uses bag randomization of the seven tetrominoes, and decide for each piece where to place it to complete at least one row before the game is lost.Hard8SimulationGreedy+2No attempts yet1s512 MBJudgeable
Sink the Billiard BallA point ball bounces off the edges of an A by B table with velocity (p,q); count edge hits until it reaches a corner, or print -1 if it never stops.Hard8MathNumber theory+2No attempts yet1s256 MBJudgeable
MeetingsCows on a line swap velocities when they meet, stop at barns, and the question asks how many meetings occur before half the total weight has stopped.Hard8SortingMath+2No attempts yet1s512 MBJudgeable
Loan RepaymentFind the largest X so that paying floor((N-G)/X) milk per day, floored at M, clears N gallons within K days.Hard8Binary searchMath+2No attempts yet2s512 MBJudgeable
SealGiven a binary document grid and a binary seal stamp, decide whether the document is exactly the union of non-overlapping (and non-rotated) placements of the stamp.Hard8ImplementationSimulation+2No attempts yet2s512 MBJudgeable
Block BreakerBlocks drop in a grid when a knocked block has a dropped left/right neighbor and a dropped front/back neighbor; after each of q moves, report how many blocks fall.Hard8Union-findSimulation+2No attempts yet2s512 MBJudgeable
Exact ArithmeticSimulate a stack calculator whose values are sums of rationals and rational multiples of square roots, and print each result in a canonical exact form.Hard8ImplementationMath+2No attempts yet1s512 MBJudgeable
Teenage SharkSimulate a 4x4 board where numbered fish rotate and swap, and a shark moves along its direction eating fish; find the maximum total value eaten.Hard8SimulationBacktracking+2No attempts yet1s512 MBJudgeable
PhysicsBalls move on a line with acceleration tied to speed, collide elastically, and each query asks for the k-th smallest velocity at time t.Hard8MathSorting+2No attempts yet1s512 MBJudgeable
Urban BlightGiven points and weighted segments, find a horizontal line whose intersection with the segments maximizes the total weight of segments it touches.Hard8GeometrySorting+2No attempts yet2s1024 MBJudgeable
Right-hand obstructionCars arrive in four queues at a crossroad; a front car passes only if the queue on its right is empty, so simulate second by second and report each car's crossing time or -1.Hard8SimulationQueue+2No attempts yet1s512 MBJudgeable
BusSimulate bus boarding with passengers sitting in the closest free seat or standing over an occupied one, and choose Anton's seat minimizing the total time someone stands over him.Hard8SimulationGreedy+2No attempts yet2s512 MBJudgeable
Folded Paper PaintingSimulate K rounds of folding a W by H rectangle along a vertical line and several horizontal folds, painting one rectangle each round through all layers, and report the unpainted area at the end.Hard9GeometrySimulation+2No attempts yet2s128 MBJudgeable
Queen and Two KingsGiven a queen and two kings on a 100x100 board playing optimally, compute the minimum number of queen moves needed to capture either king.Hard9Game theoryBFS+2No attempts yet2s128 MBJudgeable
ShotGiven columns of black/gray/white cans stacked in fixed color order, repeatedly shoot a height to remove one layer from every tall-enough column and report the collapsing score after each shot.Hard9Segment treeBinary search+2No attempts yet2s256 MBJudgeable
Pro Gamer YoungsikGiven time and resource budgets, compute the maximum number of top-tier units obtainable from a chain of unit upgrades where each unit can repeatedly spawn the next type.Hard9Dynamic programmingGreedy+2No attempts yet2s128 MBJudgeable
Paper FoldingGiven a colored paper strip, determine the sequence of folds that minimizes final length while respecting a color-matching constraint on folded layers.Hard9SimulationGreedy+1No attempts yet1s128 MBJudgeable
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Prince of PersiaGiven a grid room, mirrors with fixed orientations and allowed cells, and plates on walls, decide whether the light ray can reach every plate.Hard9SimulationGraph+2No attempts yet1s128 MBJudgeable
Deformed WheelSimulate a convex polygon rolling down a piecewise-linear hill until it comes to rest, and print the final position of its center of gravity.Hard9GeometrySimulation+2No attempts yet1s128 MBJudgeable
Parallel ExpectationsGiven two programs run by randomly interleaving their instructions, find the expected final value of every shared variable.Hard9ProbabilityDynamic programming+1No attempts yet1s128 MBJudgeable
Find the BorderGiven a closed self-intersecting polyline, count the vertices of the border of its interior, the outer boundary enclosing all bounded regions.Hard9GeometryImplementation+2No attempts yet2s128 MBJudgeable
SleepwalkerA self-similar walk on a 3^k by 3^k grid is defined by a recursive rewrite; given a starting tile on the walk and a hole tile, find the number of steps until the walk reaches the hole.Hard9RecursionDivide and conquer+2No attempts yet1s128 MBJudgeable
Recursive AntOn a 2^n by 2^n board with at most 50 forbidden cells, find for each of the four borders a cell where a recursive quarter-by-quarter Hamiltonian tour can end, or report none.Hard9Divide and conquerRecursion+2No attempts yet1s128 MBJudgeable
FishesGroup recorded closed routes into the fewest fish, where two routes can follow on consecutive days if the start cells touch and every point is visible 24 hours earlier.Hard9GraphGeometry+2No attempts yet2s512 MBJudgeable
QuestionsSimulate a logic puzzle where princes and a sorcerer reason about a system of variable constraints over time; answer what each prince or the sorcerer knows.Hard9Brute forceSimulation+2No attempts yet1s128 MBJudgeable
Video PokerFor a given video poker payout table, count how many of the 2,598,960 dealt hands make the optimal expected-value strategy discard exactly 0, 1, 2, 3, 4, and 5 cards.Hard9Brute forceCombinatorics+2No attempts yet1s128 MBJudgeable
CrystalSum the signed charges of all three-colored unit triangles in a hexagonal crystal filled row by row from a modular generator.Hard9MathGeometry+2No attempts yet1s128 MBJudgeable
Thirsty AntsAnts on a line walk at unit speed toward the nearest fallen dew drop, and the task asks for every ant's position when the last drop is drunk.Hard9SimulationSorting+2No attempts yet1s128 MBJudgeable
Aquarium DrainageGiven an orthogonal aquarium floor with holes on its segments, compute the total drain time and the water left behind.Hard9GeometrySorting+2No attempts yet1s128 MBJudgeable
CakeStarting from piece a, Leopold always eats the less delicious piece next to the empty interval, and each query asks how many pieces are eaten before piece b.Hard9Segment treeDivide and conquer+2No attempts yet2s1024 MBJudgeable
Asynchronous ExceptionsSimulate a multithreaded scheduler with yields, kills, fork modes, loops, and semaphores, then report each thread's finishing time and the final state.Hard9SimulationHeap+2No attempts yet5s512 MBJudgeable
Rotating Cutter BitsThe program counts interior lattice points of a polygonal workpiece that survive one full rotation against a second rotating polygonal cutter.Hard9GeometrySimulation+1No attempts yet3s256 MBJudgeable
Ace in the HoleGiven Ben's examination order, restore the lexicographically greatest deck with no decreasing triple that makes his optimal search follow it.Hard9Game theoryGreedy+2No attempts yet60s512 MBJudgeable
Clock BreakingGiven several consecutive LCD clock displays, find segments that are always burnt out, burnt in, working, or unknown across all consistent start times and fault assignments.Hard9ImplementationBrute force+1No attempts yet5s512 MBJudgeable
Counting points inside a circleFor each of M circle queries, count how many of N fixed points lie inside or on the circle, printing the count per query.Hard9GeometryDivide and conquer+2No attempts yet8s512 MBJudgeable
Magical Mystery Knight's TourFill the missing numbers so the 8x8 board becomes a semi-magical knight's tour with equal row and column sums, choosing the lexicographically smallest completion.Hard9BacktrackingBrute force+2No attempts yet2s512 MBJudgeable
Mole TunnelsOn a binary-heap-shaped tree, each newly woken mole (in a fixed order) must be assigned to a hole with remaining food capacity, minimizing total walking distance; report the minimum for every prefix k.Hard9TreeGreedy+2No attempts yet2s512 MBJudgeable
Map Reduce (Large)Each query asks whether walls can be removed so the shortest S-to-F path equals D, and if so reports the deterministic greedy removal order's final map.Hard9BFSGraph+2No attempts yet5s512 MBJudgeable
The Gardener of Seville (Large)Fill an R by C grid with slash or backslash hedges so that paired border courtiers connect through disjoint corridors, choosing the lexicographically smallest valid maze or reporting IMPOSSIBLE.Hard9ImplementationSimulation+2No attempts yet5s512 MBJudgeable
Shifty GridApply a fixed two-phase procedure of cyclic row and column shifts to sort a permutation grid into row-major order, following the exact TURN steps given.Hard9SimulationImplementation+2No attempts yet2s512 MBJudgeable
Stack Management (Small)Decide whether a solitaire game on 2 to 4 short stacks of cards can be reduced to at most one card per stack using two allowed moves.Hard9Game theorySimulation+2No attempts yet5s512 MBJudgeable
Jupiter Rock Paper ScissorsEach player crops a length-k substring, Alice morphs one block, then the play phase awards 2/1/1 points by who reaches m round wins first; report the optimal outcome.Hard9Game theoryImplementation+2No attempts yet2s512 MBJudgeable
In honor of Taekhee's graduationDeer bounce on a line segment [0,T], each with strength; a statue at x falls when the net force of deer that have reached it exceeds W. Maximize the fall time over x.Hard9MathSimulation+2No attempts yet3s128 MBJudgeable
Circle SelectionProcess circles in decreasing radius order; each chosen circle removes all remaining circles that intersect it, and for every circle you must report which chosen circle eliminated it.Hard9GeometrySorting+2No attempts yet3s1024 MBJudgeable
Growing MicroorganismsWith buy costs and production costs, buy microorganisms and make each kind produce others to reach x_i of every kind at minimum total cost.Hard9MathGreedy+2No attempts yet2s512 MBJudgeable
GameChoose the order in which balls are manually removed so chain reactions of merging equal neighbors delete as many other balls as possible; output that maximum count.Hard9Dynamic programmingStack+2No attempts yet2s512 MBJudgeable
MessengerDesign strategies for two players who alternately move a piece on a 4x4 grid, knowing neither the call order nor its timing, so B can deduce the secret value X within 10000 moves.Hard9ImplementationSimulation+2No attempts yet2s512 MBJudgeable
GnalcatsDecide whether two genes, each a sequence of seven possible base transformations on proteins, produce identical results or both fail on every sufficiently long input protein.Hard9StringStack+2No attempts yet0.3s512 MBJudgeable
Nonogram QRSolve a chain of 2000 nonograms to reconstruct QR codes, decode them, follow indicator links, and recover a flag.Hard9BacktrackingSimulation+2No attempts yet1s512 MBJudgeable
CerealGiven a queue of cows each with a favorite and second-favorite cereal, report for every prefix removal how many cows still get a box.Hard9GreedySimulation+2No attempts yet1s512 MBJudgeable
AdditionDesign a short string-rewriting script in a custom language that reads two binary numbers joined by + and rewrites them into their binary sum.Hard9String matchingSimulation+2No attempts yet1s256 MBJudgeable
Holy cow, Vim! (Easy)Construct a stack-language program that outputs x, but outputs 2x when its lines are reversed and -x when its lines are sorted lexicographically.Hard9ImplementationSimulation+2No attempts yet1s512 MBJudgeable
GeneratorRead an index 0 to 10 and output the exact contents of the matching recovered file gen_i.out from the archive.Hard10ImplementationString+2No attempts yet2s256 MBJudgeable
Dungeon 2Explore an unknown connected graph through a move-and-color oracle and report, for each i, how many room pairs have shortest-path distance exactly i.Hard10GraphBFS+2No attempts yet1s256 MBJudgeable
Shadow CompanionConstruct a fixed program over a bit tape with a shadow that transforms every input n < 2^10 into n squared.Hard10SimulationBit manipulation+2No attempts yet2s512 MBJudgeable
Delightful (Easy)Write a program of at most 100 commands for a ternary computer with 26 40-trit registers that computes the length of the longest non-decreasing prefix of the input in register X and leaves the answer in Y.Hard10ImplementationSimulation+2No attempts yet1s512 MBJudgeable