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 results575 problems
TitleLevelTopicsSolvedTime limitMemory limitJudge
Sensor NetworkFind the largest group of sensors where every pair lies within distance d and print its size and members.Hard8BacktrackingGraph+1No attempts yet2s128 MBJudgeable
SnakeReconstruct the Hamiltonian path numbering of a 3 by n board from some given cell numbers.Hard8BacktrackingGraph+1No attempts yet3s512 MBJudgeable
Self-Describing SequencesCount length-N sequences where each entry A[i] equals the number of times i appears in the sequence.Hard8MathCombinatorics+1No attempts yet1s256 MBJudgeable
A Die MakerRoll a die on a board so each move increments the face that lands down, and print the dictionary-smallest move string that reaches the six target numbers.Hard8BFSGreedy+2No attempts yet8s256 MBJudgeable
One Clean Slice!Split an R by C by H block with guillotine cuts into N boxes with one raisin each to maximize the smallest box volume.Hard8BacktrackingBinary search+1No attempts yet1s16 MBJudgeable
Selling NumbersCount how many D-digit strings, with leading zeros allowed, have exactly the memorability score S defined by palindromic and repeated substrings.Hard8BacktrackingCombinatorics+1No attempts yet2s256 MBJudgeable
Tree of PainDecide for each small pattern tree whether it embeds into the organization tree with matching labels and ancestry preserved both ways.Hard8TreeDynamic programming+2No attempts yet1s256 MBJudgeable
MosaicFill empty grid cells with black right triangles so white regions form rectangles and numbered squares meet their counts, then report the triangle total.Hard8BacktrackingBrute forceNo attempts yet1s256 MBJudgeable
Tour de FranceFind the shortest directed tour that visits each of up to 36 cities exactly once when every city has at most two outgoing and two incoming roads.Hard8BacktrackingGraphNo attempts yet2s256 MBJudgeable
Hole in OneFind the most walls a ball shot from the origin can destroy by bouncing off axis-aligned walls before dropping into the hole.Hard8BacktrackingGeometry+1No attempts yet5s256 MBJudgeable
ICPC TeamsCount ways to split 3N students into teams of three so all M same-team and different-team pairs hold, modulo 1e9+9.Hard8CombinatoricsUnion-find+1No attempts yet3s256 MBJudgeable
Watering the fieldsCover every non-scarecrow cell with trominoes of three cells while letting at most R times C trominoes cross field borders.Hard8ImplementationBacktracking+1No attempts yet1s128 MBJudgeable
HypercubeDecide whether a tree-like polycube of eight cubes folds along shared faces into the surface of a four-dimensional hypercube.Hard8BacktrackingGeometryNo attempts yet1s256 MBJudgeable
King's InspectionFind the lexicographically smallest directed tour that starts and ends at city 1 and visits every other city exactly once.Hard8GraphBacktracking+1No attempts yet10s512 MBJudgeable
Routing a Marathon RaceFind a simple path from junction 1 to junction n that minimizes the total personnel cost of the junctions on the path and their direct neighbors.Hard8BacktrackingGraph+2No attempts yet3s256 MBJudgeable
Connect the CellsConnect each color pair with disjoint grid paths that cover every cell and print the lexicographically smallest direction map.Hard8BacktrackingGraph+1No attempts yet3s256 MBJudgeable
High JumpReconstruct each height's clears and misses from the recorded attempt order and report the top three jumpers under the countback tiebreak.Hard8SimulationBacktrackingNo attempts yet1s256 MBJudgeable
Alphabet Blocks and PasswordsArrange A to Z into the lexicographically smallest permutation with none of the given passwords appearing as a contiguous block.Hard8BacktrackingString matching+1No attempts yet5s512 MBJudgeable
Drum Decorator (Small)Count cylindrical grid fillings where each cell holding K has exactly K equal neighbours, up to rotation, modulo 1e9+7.Hard8CombinatoricsDynamic programming+1No attempts yet5s512 MBJudgeable
The peak that looks highestGiven each peak's apparent-highest peak ahead, assign integer heights matching all sightings and print the lexicographically smallest heights or Impossible.Hard8GeometryBacktracking+1No attempts yet5s512 MBJudgeable
Yut Nori (Large)You receive every throw in order and the pieces left on the board, and you decide whether the game rules can produce that board.Hard8BacktrackingSimulation+1No attempts yet10s512 MBJudgeable
Mystery Square (Large)Fill each ? in the binary string with 0 or 1 so the result is the binary form of a perfect square.Hard8Number theoryBacktracking+1No attempts yet60s512 MBJudgeable
Ninjutsu (Small)Cut the rope to any length up to R so the counterclockwise swing bends around the maximum number of point targets.Hard8GeometryBacktrackingNo attempts yet5s512 MBJudgeable
Number of Simple CyclesGiven two trees on N vertices with N up to 9, choose a bijection linking them to maximize the number of simple cycles of length K.Hard8BacktrackingGraph+2No attempts yet2s512 MBJudgeable
Red segments and blue segmentsColor N points red or blue, then draw non-crossing same-color segments so that no red and blue segment touch; maximize total segment scores.Hard8Dynamic programmingGeometry+2No attempts yet2s512 MBJudgeable
Color the Map ExtremeGiven simple polygons for each country, decide adjacency when borders share a positive-length segment, then find the chromatic number of the adjacency graph.Hard8GeometryGraph+1No attempts yet8s512 MBJudgeable
Segments in a Regular PolygonCount the orders in which the remaining polygon vertices can be visited so each new segment crosses an existing one and the path closes back to P0.Hard8BacktrackingDynamic programming+2No attempts yet2s512 MBJudgeable
Palindrome cipher decryptionFor each string, find its longest palindromic subsequence and output the lexicographically smallest one among those of maximal length.Hard8Dynamic programmingString+2No attempts yet8s512 MBJudgeable
Restriction Enzyme MapReconstruct which positions on a circular DNA of length up to 20 are cut by enzyme A or B, given the distinct fragment lengths from cutting with A, with B, and with both, minimizing site count then lexicographic order.Hard8Brute forceBacktracking+2No attempts yet8s512 MBJudgeable
Invisible IntegersGiven up to 10 hints, each a walk order of distinct digits 1 to 9, find the shortest hidden integer sequence that can produce every hint.Hard8BacktrackingDFS+2No attempts yet5s512 MBJudgeable
Game on GraphOn a directed graph, Gennady prefers an endless game over winning and Georgiy prefers winning over everything but an endless game; report the outcome (W, L, D) for every start vertex and both first players.Hard8GraphGame theory+2No attempts yet2s512 MBJudgeable
The Gardener of Seville (Small)Fill an R by C grid with / and \ hedges so that each given pair of border courtiers is connected by a wall-free path, choosing the lexicographically smallest grid.Hard8BacktrackingBrute force+2No attempts yet5s512 MBJudgeable
CommunismAssign each of N jobs to one of three people so that Ad's total and Larry's total differ by at most D, and count the assignments.Hard8MathBacktracking+2No attempts yet1s512 MBJudgeable
Operation (Small)Given a start value S and up to 15 operation cards, order all cards to maximize the final rational result, printed as an irreducible fraction with positive denominator.Hard8Brute forceBacktracking+2No attempts yet5s512 MBJudgeable
Keep it coveredDecide whether a grid of dots and empty cells can be tiled by four line-piece types so that lines match across shared sides and never touch the border.Hard8GraphDFS+2No attempts yet1s1024 MBJudgeable
SumdokuFill a 9x9 Sudoku grid so that constrained adjacent cells inside each 3x3 block satisfy <, =, or > versus 10, and print the lexicographically smallest solution.Hard8BacktrackingImplementation+1No attempts yet2s512 MBJudgeable
Making a Beautiful PuzzleFill each square of an N by M board with one of four colors so that orthogonal neighbors differ, maximizing total beauty and counting optimal placements modulo 1e9+7.Hard8Dynamic programmingBacktracking+2No attempts yet3s128 MBJudgeable
Frogs 2Assign one frog to each pad so that every frog sits on a preferred pad and each log joins two frogs with equal interest in the log's topic.Hard8GraphBacktracking+2No attempts yet1s256 MBJudgeable
Ladder ManipulationGiven a ladder with N vertical lines, H rows, and M existing rungs, find the minimum number of rungs to add so every walk from column i ends at column i, or report -1 if more than 3.Hard8BacktrackingBrute force+2No attempts yet2s512 MBJudgeable
PathsCount simple paths in a vertex-colored graph where every vertex on the path has a distinct color, counting both directions separately.Hard8GraphDFS+2No attempts yet3s1024 MBJudgeable
Turf WarsEach gang owns disjoint axis-aligned rectangles; pick exactly one rectangle to drop per gang so that no two kept rectangles from different gangs overlap, and report whether this is possible.Hard8GeometryBrute force+2No attempts yet2s512 MBJudgeable
Playoff by all the teamsCount the ways to fill in the unplayed matches of a round-robin tournament so that every team ends with the same number of wins.Hard8Brute forceBacktracking+2No attempts yet2s512 MBJudgeable
Word ClockPlace n distinct words left to right on an h by w grid where words may share letters, or report that no placement exists.Hard8BacktrackingImplementation+2No attempts yet2s512 MBJudgeable
Club Room ExpansionGiven each cell's count of walled directions (0 to 4), decide whether the grid can be fully partitioned into connected rooms of one to three cells fitting that wall count.Hard8Dynamic programmingBacktracking+2No attempts yet1s512 MBJudgeable
InversionGiven the inversion graph of a permutation on at most 100 vertices, count its independent sets that also dominate every vertex outside. The answer fits in 10^18.Hard8GraphBrute force+2No attempts yet1s512 MBJudgeable
Interesting World of ArraysCount arrays of length n whose values each satisfy a[i] = count(i) mod m, for n up to 12 and m up to 1e9.Hard8CombinatoricsMath+2No attempts yet2s512 MBJudgeable
MaaaaaaaaazeGiven five 5x5 boards, rotate each freely, stack them in any order, then find the shortest path through the resulting 5x5x5 cube from one corner to the opposite corner.Hard8Brute forceBFS+2No attempts yet2s512 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
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
OnesFor each k up to 1e9, output a 1-expression using only ones, +, *, and parentheses that evaluates to k with at most 100 ones, or NO.Hard8Dynamic programmingMath+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
Counting Multiples by Divisor CountGiven N up to 10^18, count positive integers X that are multiples of N and have exactly N divisors, or report infinitely many.Hard9Number theoryCombinatorics+2No attempts yet1s512 MBJudgeable
L GameGiven a 4x4 L-Game board, determine if the player to move has a forced win, output the lexicographically smallest winning resulting board, or report draw/loss under perfect play.Hard9Game theoryBrute force+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
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
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
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
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
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
Growing Orthogonal SpiralDecide whether an orthogonal spiral whose segment lengths grow by at least 1 can end exactly at (x, y) and print the shortest such lengths.Hard9MathNumber theory+1No attempts yet1s256 MBJudgeable
Bulb PuzzleYou rotate every elbow and straight wire so all wires form one path that joins the two bulbs, and print the smallest such layout.Hard9GraphBacktracking+1No attempts yet1s256 MBJudgeable
Calvinball Championship, Again 2Split n players into the fewest teams so no pair who dislike each other shares a team.Hard9GraphBacktracking+1No attempts yet1s256 MBJudgeable
Paths of Yin and Yang (Small)Count the black-and-white colorings of an N by M grid in which each color class forms a single path with two ends.Hard9CombinatoricsBacktracking+1No attempts yet30s512 MBJudgeable
King GameOn a small board with burned squares, two players alternately move a king to an unvisited neighboring square; report who wins under optimal play.Hard9Game theoryGraph+2No attempts yet5s512 MBJudgeable
Binary cryptarithm decryptionGiven a short cipher string where letters replace some characters of an unknown binary equation, count how many valid equations from the given grammar match it.Hard9BacktrackingDynamic programming+2No attempts yet2s512 MBJudgeable
Game MovesGiven a reachable 2048 board and its score, find the minimum number of moves that could have produced that state, using the merge rules and random tile births.Hard9Dynamic programmingBacktracking+1No attempts yet1s512 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
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
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
General graph matchingGiven an undirected graph with N vertices and M edges, print the size of a maximum matching.Hard9GraphGreedy+2No attempts yet1s128 MBJudgeable
Cryptarithm?!Given three letter strings A+B=C, decide whether some assignment of distinct digits to letters makes the addition valid, columns up to 18 long.Hard9BacktrackingMath+2No attempts yet1s128 MBJudgeable
RulerFind the shortest ruler with N marks (0 to L) where all pairwise distances between marks are distinct, and print the mark positions.Hard9BacktrackingBrute force+2No attempts yet2s512 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
LogoGiven up to five polyomino patch shapes (each a subset of a 3x3 grid, flippable and rotatable) and up to three grid designs up to 55x5, decide if each design can be tiled exactly by non-overlapping patches and find the minimum patch count, or report NIE.Hard10Dynamic programmingBit manipulation+2No attempts yet1s128 MBJudgeable